From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

send data from GPIB Read Function to XY Graph

Solved!
Go to solution

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. 

0 Kudos
Message 1 of 13
(3,635 Views)

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.

 

Write to XY Graph.PNG

 

Message 2 of 13
(3,629 Views)

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?

0 Kudos
Message 3 of 13
(3,620 Views)
Solution
Accepted by topic author rob_xx17

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.

 

0 Kudos
Message 4 of 13
(3,609 Views)

gotcha. thanks a million for your help and for the link to tutorial.

 

r. 

0 Kudos
Message 5 of 13
(3,605 Views)
You might want to mark my answer as the solution instead of your thank you. You can change it by clicking on 'Options'.
0 Kudos
Message 6 of 13
(3,600 Views)

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. 

0 Kudos
Message 7 of 13
(3,587 Views)

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.

0 Kudos
Message 8 of 13
(3,571 Views)

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.

 

Picture 2.png

 

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

0 Kudos
Message 9 of 13
(3,564 Views)

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.

0 Kudos
Message 10 of 13
(3,559 Views)