LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting an array

I'm trying to build an array of two rows.  Each row is generated from continuously sampling a physical channel.  The rows will then be plotted on a single graph. I can't figure out how to build up the array while maintaining the 2-row n-column shape.  This is what I've tried.

  • Use shift registers and a build array vi.  When I try this the appended array will have an extra row.  As a result, LabVIEW will throw an error saying the 3 dimensions from the source (shift register) does not match the 2 dimensions of the sink (graph) when the appended array is connected to a graph. 
  • Using an auto-indexed tunnel.  This causes the same issue as above.  An extra row appears and the output of the tunnel cannot be connected to a graph. 
  • Using a chart instead of a graph. This does plot the data correctly, but after I hit the while loop stop button the data will scroll off the chart. 

I also tried using the Delete from Array vi to try to delete the third row.  This seems to only delete data from the elements but does not delete the row itself. I've attached my VI.  Does anybody know how to plot two sets of sampled data to a single graph?  I'm ok with the data being plotted after the while loop is stopped.

0 Kudos
Message 1 of 3
(2,133 Views)

You need to learn a little more LabVIEW.  I'm assuming you are doing this "on your own", and don't understand the difference between a Graph (where you have either sets of X-Y pairs or sets of Y data assumed to be equally-spaced, and you plot all those points at once) vs. a Chart (where you always have equally-spaced sets of data, and you append these data as though you are plotting data continuously on a Chart Recorder, or on an oscilloscope).

 

When dealing with DAQmx, where you get chunks of data from multiple channels every time DAQmx Read fires, you almost always use Charts, as the data are continually coming in and you want to see all (or as much as fits) of the data, not just the latest sample.

 

You can learn more about this by going to the beginning of the Forum and looking at the Tutorial offered there.  Look at Graphs and Charts.  Or go to LabVIEW Help and look up Graphs and Charts.  Or look at the DAQmx Examples (Help, Find Examples) that ship with LabVIEW.  Better for you to find it yourself (you'll learn, retain it better, and will enjoy a sense of accomplishment) than for us to simply say "Do this ...".

 

Bob Schor

0 Kudos
Message 2 of 3
(2,122 Views)

2 things:

 

1) If you use a build array node and want to avoid adding a new dimension, there's a right-click option on it named "concatenate inputs".  If you activate this it will stay as a 2D array instead of becoming 3D.  However, you need to know that if your array dimensions don't match it'll put in a bunch of zeroes to pad it out.

 

2) You might do better to use one of the DAQmx polymorphic selections that outputs a waveform instead of a 2D array.  You can then use the "Append waveforms" VI to attach them to each other.

0 Kudos
Message 3 of 3
(2,101 Views)