LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a table to XY graph?

Solved!
Go to solution

Hi

 

I am new to LabVIEW. For my degree course, i have to create a graph of load on a beam against the voltage reading from a rosette strain gauge.

 

I have managed to create the table required, and i can export it to Microsoft Excel to create the graph there, and that works fine. However, ideally, i would like to just use LabVIEW to create the graph.

 

Attached is an example of the table after the test is run. [table1]

 

from this table i need to plot 3 lines (A,B,C) on a single graph of voltage(y-axis) against load(x-axis), with a line of best fit for each one.

 

Also attached is an example of the graph created on excel, to give an idea of what i'm trying to create. [graph1]

 

Any help would be much appreciated, as i am new to using Labview.

Thanks

 

Table1.jpggraph1.jpg

 

0 Kudos
Message 1 of 14
(11,889 Views)

Create an X array with the values (2;4;6;8;10)

Bundle your X-array to your first Y-array(1st column)

Bundle your X-array to your second Y-array(2nd column)

Bundle your X-array to your Third Y-array(3rd column)

 

Connect these three to a build array

 

Connect the output of the build array to your XY graph

 

More info can be found here , example

 


 

X-Array Y-Array Definition: 
You can define a plot as a cluster that contains an array of x coordinates and an array of y coordinates. Build an array of such clusters to define a multi-plot XY Graph.

 


 

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 2 of 14
(11,872 Views)

Here are some hints to get you going...

Treat the table as an array. By using 'index array' you can access individual elements, or more usefully whole columns or rows.

The information in your table is probably in string format. Have a play with the String/Number conversion functions to convert the text into numbers.

Using these two bits of info should get your data in the right format to feed into a graph.

Graphs take arrays of data bundled together as X-data and Y-data.

 

If your data is starting off as a 'number' before turning into text inside the table, you could bypass the conversion by feeding it straight into the graph?

 

Thats a couple of ideas to be going on with, post back once you've had a go.

 

Ian

 

EDIT: Looks like Bjorn got in whilst I was still typing, still theres two sets of info for you.

Message 3 of 14
(11,866 Views)

Thank you both so much for your help. I have managed to build the graph required, but the only way i can figure out how to do it is by using number controls in each array and entering the values from the table individually.

 

This gave the right graph, but is there a way i can seperate the 3 columns of data and put them into each of the Y-arrays?

 

I think using the index array suggested by Ian would work, but how can i get the required column?

 

thanks again for your help

 

Luke

0 Kudos
Message 4 of 14
(11,860 Views)

Use "index array" and wire a constant to the index.  0=first column ; 1= second column

You can use string in your table, but you have to convert the array to numbers by using the VI "string to number"

you don't have to do them one by one, you can wire an array as input

Kind regards,

- Bjorn -

Have fun using LabVIEW... and if you like my answer, please pay me back in Kudo's 😉
LabVIEW 5.1 - LabVIEW 2012
Message 5 of 14
(11,856 Views)

As an example, see the attached.

The index array function lets you get at an entire colum (or row) by leaving one of the inputs unwired.

To get more than one column at a time, click and drag the bottom of the icon downwards to access more terminals.

 

EDIT: Doh, Bjorn got in there already again. Smiley Very Happy

Message 6 of 14
(11,851 Views)

please find attached my vi

 

I can;t see why it is giving me an error. I tried the string to number conversions between the index array and the different bundles, but it gave errors each time. I tried it without and it is still giving me an error.

 

Thanks for your help

 

Although the table is empty, i have tried it with my data and the error is still there

0 Kudos
Message 7 of 14
(11,839 Views)

See the attached where I've wired up a string conversion to each string array.

I can't test it with your data as no default values are present, however it seems to work OK.

 

Is that what you needed?

 

Ian

Message 8 of 14
(11,830 Views)
Solution
Accepted by lukemoss88

I managed to figure out what i'd done wrong. I was just in the process of posting this when you posted your response Ian.

 

Thank you Ian and Bjorn for both your help. It is greatly appreciated

 

Luke

0 Kudos
Message 9 of 14
(11,825 Views)

Not sure how you've implemented it, but putting the conversion before the index array probably makes more sense that the previous version I posted:

table to graph.PNG

 

 

 

PS Its generally more helpful for people with similar problems in the future if you mark the post that solved your problem as the solution, not a post which doesn't show the solutionSmiley Tongue

Message 10 of 14
(11,820 Views)