Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Measurement Studio v7 and C#.Net -- graphing binary data?

Hi,

I'm trying to graph a binary string with a waveform graph (using C#) in VS .NET 2003.  however, i can't seem to get it to work.  Any help would be greatly appreciated!

Thanks.

0 Kudos
Message 1 of 7
(4,593 Views)


just for a clarification: 


i am calling a method:  GraphData (binaryString)

it's simply a string of binary data... i'm not pulling the data from a DAQ device or anything... i'm just simply wanting to display it.



Again, thanks so much for any help  

0 Kudos
Message 2 of 7
(4,595 Views)
bump..



any help?


thanks
0 Kudos
Message 3 of 7
(4,574 Views)
Greetings njuneardave!

Thank you for contacting National Instruments!

I'm going to assume that when referring to a "binary string" you mean that you are simply trying to graph an array of binary data and not actually trying to graph a "string" data type.  In order to simply display your data on a graph using Measurement Studio, I would recommend calling the PlotY method on your graph and passing it the binary array you've created.  Something like the following code should be sufficient:

myGraph.PlotY(binaryArray);

Of course, this assumes that the WaveformGraph you've placed on your Form is named "myGraph" and that your binary data is stored in an array called "binaryArray" - you should customize this code to your application.  Also, the PlotY function is overloaded several times to handle different parameter types depending on what you intend to pass.  Descriptions of the methods associated with the WaveformGraph control can be found in the Measurement Studio Help.  You can access the help file by selecting Measurement Studio»NI Measurement Studio Help from within your Visual Studio environment.

Please post further if you require more assistance, but otherwise, best of luck with your application!
Derrick S.
Product Manager
NI DIAdem
National Instruments
0 Kudos
Message 4 of 7
(4,562 Views)
Derrick,

Thank you for your advice.  I should've been more specific in my original post.  Yes, I took a binary string and converted it into an array of type double and then called the plot method.  however, on successive transitions (i.e. 1,0 or 0,1 instead of 1,1,0 or 0,0,1), a waveform similar to a sawtooth wave was produced.  I am supposing that this sawtooth is generated because the waveform graph plots y = f(x) graphs in which there can only be one value for any Y value.  Does this mean that there is no way to produce straight up and down lines between bit transitions? 



Summarizing:  PlotY(binaryArray) doesn't work because quick transitions like 0,1,0,1,0,1,0 produce a sawtooth waveform that looks like:  /\/\/\/\/\/\/\ instead of a true binary graph.  i tried to copy my data over 10 times so for every 1 bit, there was actually 10 bits, but i still had slanted lines instead of vertical lines.  My work-around is to use PlotYAppend and graph each individual transition, but this becomes very slow for large binary arrays.  Any other advice?
0 Kudos
Message 5 of 7
(4,525 Views)
Hi njuneardave,

First off l did want to mention that in Measurement Studio 8.0, we introduced the Digital Waveform Graph that might be of some use to you.  Not sure if it really helps your situation, but just thought I would throw that out there.

To address your current situation, you can simply change the LineStep property to something other than None and you will get the desired "binary" graph instead of the sawtooth graph.  To access this property, right-click on your graph and select Edit Plots... Then configure the LineStep item as shown in the attache LineStep Property.jpg snapshot. The outcome of setting this property is shown in the attache LineStep Binary Data.jpg snapshot.

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
Download All
0 Kudos
Message 6 of 7
(4,502 Views)
Excellent!


Thank you so much for that information, Jonathan.  I followed your steps just as you said and everything worked to a 'T'.  Thanks again for the top-notch support.
0 Kudos
Message 7 of 7
(4,498 Views)