LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquire output array after data acquistion when using a case structure

The empty array was left over when I was transposing an array that I was try to build. I had to start with a 2D array. It just ended up staying because as things changed it didn't cause any harm. It can be removed. Didn't know I could expand the index array. When I ran your mod6 I didn't get the array output I was expecting. If you expand the array so you can see the data it wasn't right (it's in two columns). So I kept the waveform and just picked the channels off and then built the array. The array In mod9 is what I'm expecting. Now I need to be able to build the array if only one channel is selected or if up to four channels are selected. I can use 2D arrays if the array can be built.
0 Kudos
Message 11 of 15
(822 Views)
When you acquire a 2-D array of doubles, you will get one column for each data channel you are acquiring.  You will get one row for each data point you read.  So if you acquire 2 channels by 10 points, you will get a 2 column 10 row array.  (Note, it's possible it's 2 rows, 10 columns, I don't have a way to test how the data is oriented in an array.)
 
If you collected only 1 channel in the N channels N samples method.  You still have a 2-D array with a single column for that one channel and X number of rows for the X data points you collect.
 
If you are collecting a 1-D array of waveforms, you could feed that array into a For Loop with an autoindexing tunnel.  The loop will run through each element (i.e. channel) of the array one by one no matter how many channels there are.  But if you insist on using waveforms, you are just complicating things because it gives you one more layer to the data structure you are dealing with.  What you are doing may work, but I think you aren't handling the array manipulations the way you really want to.  I would bet the Build arrays that have concatenating inputs shouldn't be, and the Build array that is not concatenating should be.
 
EDIT: To clarify, here is the description of the array from the Read DAQmx 2-D double that comes from context help:
 
"data returns a 2D array of samples. Each row corresponds to a channel in the task. Each column corresponds to a sample from each channel. The order of the channels in the array corresponds to the order in which you add the channels to the task or to the order of the channels you specify with the Channels to Read property."


Message Edited by Ravens Fan on 08-06-2008 03:31 PM
0 Kudos
Message 12 of 15
(817 Views)
I inserted a transpose array into your mod6 and the array outputted as needed. I then added a second channel and the array again outputted as I need it to. However, the chart doesn't work. Collecting an odd number of samples with one channel a 0 is collected at he end and the chart display disappears. When collecting multiple channels the chart treats the data as one data stream. So using 2D array solves the problem of creating the array and the data is saved to file correctly, but the chart doesn't work. If its not one thing its another. Any suggestions on getting the chart to display correctly?
0 Kudos
Message 13 of 15
(809 Views)

Forget the last statement in the previous post. The chart had transpose array checked. I unchecked it and the display worked. I think everything is working now. I will test further.

Thanks to all.

0 Kudos
Message 14 of 15
(803 Views)

Here is the end result. The solution is not that different from Mod5. I Put the build array function inside the while loop and used a convert from dynamic data and a transpose array to get the data in the format required to build the array. The array is initialized with a blank array each time the while loop is called because the whole loop is housed inside a for loop and is called multiple times to collect data for each calibration point (controlled by the for loop). I did not include the for loop because it just added another layer. What this vi allows is the collection of a finite number of data points specified by the user. The data points can be 1 or thousands. The vi programmatically terminates the data collection when the requested data is read from the buffer without the user having to hit a stop button. The read vi also does not timeout because it is housed inside the while loop. The data is displayed on the chart with time as the x axis and is saved in a measurement file with its header information. I’m also building an array because once the data points are collected, I average them and build another array to perform best fit equations and graph the data points and the best fit equations.

 

Thanks for everybody that helped and made suggestions not only to this post but the two or three others that preceded this one.

 

Eric

0 Kudos
Message 15 of 15
(791 Views)