LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trouble using indexing to split data into five data sets

Solved!
Go to solution

Hi,

 

I am using labview to program a mass spectrometer.  I want to perform multiple ion monitoring where I monitor the level of five different mass over time.  The five different mass correspond to five voltages which are sent via DAC to my instrument.  After each voltage is sent, a voltage is then read with AIN.  Using indexing and a for loop I can send perform this function.

 

My problem is being able to plot this data.  I need a plot of AIN voltage (y) and time (x) for each of the five voltages (mass) and the plots to be displayed on one chart.  I do not know how to correlate the data from the indexing to separate it into five different mass and then repeating the experiment appending the data to each mass using the while loop.  When I have tried I just get the data plotting as a straight line as one data set when I need five data sets.

 

I have attached my vi.  Any help would be great.

0 Kudos
Message 1 of 3
(2,259 Views)
Solution
Accepted by topic author louise85

Your basic VI design is flawed:

  • There is no reason for you to have 2 while loops. One is suffient.
  • You should not be opening the interface in each loop iteration. Open outsides, do your work, and then close when you're done looping. 

As for the charting, get rid of the inner loop and eliminate that Build Array that you have outside the for-loop. In order to have a chart plot multiple lines you need a 2D array. Since you are using a for-loop to acquire one reading at a time you will need to create a 2D array out of the for-loop. To do this, put a Build Array inside the for-loop and then a Transpose 2D Array function outside. See the attached example.

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

Hi,

 

Thanks very much for your help.  The graph is now plotting correctly.

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