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: 

Indexing data on a for loop to overlay data on a xy graph

I am using express VI's to measure both voltage and current data in a For Loop. I want to plot a current vs voltage graph but have each iteration of the loop overlay the others as if it were its own independent data set. I have been unable to bundle the data and convert it into a xy graph because of the number of elements, 3 for the bundle and 2 for the graph. I need a method to index the dynamic data wires so that I can overlay them.
0 Kudos
Message 1 of 3
(2,507 Views)
The x-y graph expects either an array of clusters (xy values) to be wired in, or a cluster containing an x array and a y array. For multiple plots, the x-y graph expects an array of clusters containing an x array and y array each. You can think of each cluster as a "plot".

Since the x-y graph has no history (no buffer), you will need to keep all of the plot information around in each iteration of the for loop. This can be done using a shift register.

Each time through the loop, you can use the build array function to add an additional channel (an extra plot) to the x-y graph.

To obtain the x and y arrays that you will put into a cluster, you can convert from the dynamic data type into a 1D array of scalars. You can find this on the functions pallette under express, signal manipulation, from ddt.

I hope this helps. Please let me know if you need additional help.

Casey Weltzin
National Instruments
0 Kudos
Message 2 of 3
(2,501 Views)
Hello,
 
After reading the thread, it sounds like you're looking for a chart-like graph - I have attached an example with illustrates this.  Keep in mind that "graphs" in LabVIEW generally plot arrays of data (in the case of an XY graph, you pass a cluster which contains an X and Y array).  The example behaves like a chart by building an array one data point at a time (in this case both an X and Y array of course) on each iteration of a loop, and displaying the data at each loop iteration - this gives the look and feel of a chart which accumulates data.  It is attached in version 7.1 - hopefully you have that version or later to open it.  I have also attached a program which shows how to plot multiple data sets on an XY graph, in all 3 current formats accepted by the XY graph - it's attached in version 8.0 because the ability to plot complex data to an XY graph was added to version 8.0, and it illustrates this as well.
 
Best Regards,
 
JLS
Best,
JLS
Sixclear
Download All
0 Kudos
Message 3 of 3
(2,486 Views)