08-01-2009 03:25 PM
hello
I'm really new to LabVIEW so this is probably an easy one, but I'm having a serious issue trying to figure this one out. how do I send data from GPIB Read Function to a graph, let's say XY Graph. my data consists of a string of numbers, separated by commas, alternating between X and Y values. for instance:
0, 0, 0.1, 0.2, 0.2, 0.4, 0.3, 0.9, 0.4, 1.6, 0.5, 2.5, 0.6, 3.6, 0.7, 4.9
which would graph a parabola. I tried to connect the output (data) of BPIB Read Function to XY Graph, but I get an error. do I have to do something else before I send that data to the XY Graph? thanks for any suggestions.
r.
Solved! Go to Solution.
08-01-2009 03:55 PM
Yes, you have to format it into the cluster that the XY graph expects and how it is shown in the help. I would suggest that you convert the string to an array with the Spreadsheet String to Array and then get the separate x and y arrays with the Decimate Array function.
08-01-2009 05:54 PM
first of all, thanks a bunch for replying
I added "spreadsheet string to array function" and it looked OK (I didn't connect anything to 'array type' because I couldn't figure out what those blocks were - I'm really new to LabVIEW"
I couldn't find "decimate array" so I added "decimate 1D array," which is what my labVIEW listed (I have 8.6). I fed that directly into "express XY Graph," which lets me feed separate X and Y values (or so I assume). but, even though the input to "decimate 1D array" and output of "spreadsheet string to array function" say 'array' - the program is not happy. when I move my mouse over the 'x', the following is the message that I get:
"you have connected two arrays of different dimensions.
The dimension of is 2.
The dimension of is 1."
I'm not quite sure what that means. any suggestions what I can do with it?
08-01-2009 06:34 PM
You have to specify the data type of the Spreadsheet String to Array. It's a 1D DBL array constant. Go to the array palette and drag the Array Constant to the block diagram. Go to the Numeric palette and drag a numeric constant to the block diagram. Right click on the numeric constant and select Representation>DBL. Drag the numeric constant inside the Array Constant. Wire it up.
You should check the tutorials.
08-01-2009 06:53 PM
gotcha. thanks a million for your help and for the link to tutorial.
r.
08-01-2009 06:54 PM
08-01-2009 07:20 PM
I meant to mark your answer as the solution but by mistake I clicked on yours.
is there any reason why my graph is not displaying anything? I don't get any error messages but the graph is just empty with no values?
r.
08-01-2009 08:51 PM
Are you sure that you are getting the string you originally posted? Or is it a single XY pair? If it's a single pair, you have t make sure that the Build XY Graph reset function is set to False.
If you don't already have a string indicator, create one on the output of the VISA Read. Run the VI so that there is data in the indicator. Go to the Edit menu and select 'Make Current Values Default'. Save the VI and attach it to a post.
08-01-2009 09:59 PM
I think this is what you're asking about:
I have the data sent to external file and that seems to work fine. I also tried to have the graph block outside of the block and that didn't work either
r.
this is a sample of the output file:
+0.0000E+00,+02.0197E-09,+0.0630E+00,+0.63524E-06,+0.1260E+00,+01.2701E-06,+0.1890E+00,+01.8926E-06,+0.2520E+00,+02.5222E-06,+0.3150E+00,+03.1609E-06,+0.3780E+00,+03.7841E-06,+0.4410E+00,+04.4131E-06,+0.5040E+00,+05.0510E-06,+0.5670E+00,+05.6749E-06,+0.6300E+00,+06.3032E-06,+0.6930E
08-01-2009 10:20 PM
That is not what I asked for. You have absolutely nothing in the front panel indicator so you did not set defaults and save. I suspect you are only getting a single pair but because you did not do as I asked, I can't prove it. You also are resetting the XY graph each time and I also told you to change that. Immediately go to the help menu and select 'Show Context Help' and then use it to see where the reset input is. Then wire up a false constant to it.