Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx read 1d or 2d

Solved!
Go to solution
Attached I have a 4 channel daqmx read that is 2d nchan - nsample. I can't get the IIR filter to work with the 2d data. I can get it to work with 1d but that isn't what I wan't. Can the IIR filter be made to work with the 2d data? The vi is working now because I just left the filter unwired.
0 Kudos
Message 1 of 9
(4,243 Views)

Your DAQmx Read should be set to return a 1D Waveform array. The filter will then work. Even with a 1D DBL array wired to the filter function, you are throwing away all of the timing information (dt) and that is required if you want the filter to work correctly. With a DBL array, the dt will default to 1 sample/sec.

 

 

0 Kudos
Message 2 of 9
(4,240 Views)
Thanks Dennis, the problem I am having is that I can't get the 1d waveform data to save correctly. That is, when I save the data either as a user selected number of samples, or as a user selected time (ex. 2 seconds) the 2d verision of the program (attached) saves the correct number of samples. If I set the samples to 250 at a rate of 1000 hz and save 3 seconds worth of data I get 3000 samples. If I select samples and save I get 250 samples. This is what I wan't. However, I can't get this to work with the 1d data and I can't get the IIR filter to work with 2d data as stated above. The attached vi does what I need but I can't get the IIR filter to work. If I change to a 1d data type then my save function (located in the event structrue) doesn't work correctly. See attached vi.
0 Kudos
Message 3 of 9
(4,222 Views)
If you change to a 1D waveform array, in order for your save to work, you also have to change the data type of the Obtain Queue. Did you do that? I don't see how changing from a 2D DBL to a waveform data type would change the number of samples. Probe the output of the DAQmx Read. Each of the Y arrays in the waveform array should have 250 elements.
0 Kudos
Message 4 of 9
(4,219 Views)

Dennis Knutson wrote: 
Probe the output of the DAQmx Read. Each of the Y arrays in the waveform array should have 250 elements.

 

I have. That seems to be the problem and I am not sure if it is related to the timing I use for the 1d array. When it is 2d I get 250 samples each read. When it is 1d I get 4 samples, which is the number of channels.

0 Kudos
Message 5 of 9
(4,213 Views)
I'm not sure I believe that you only get 4 samples. You should be getting a 1D waveform array with 4 elements and each element has 250 samples. Do an experiment for me, please. Create a 1D waveform array indicator and wire it to the DAQmx Read. Run the VI for a single acquisition. Then go to Edit>Make Current Values Default and save the VI. Post that.
0 Kudos
Message 6 of 9
(4,203 Views)
Ok I have attached your request. You are correct in that the 1d waveform has a y component that is 250 samples. When I run this through the queue and attach an indicator I have 4 values that are being updated at each read. The 2d array doesn't do this, it has 4 rows and 250 columns updated at each read (that is what I want). The 1d data from the queue has 4 values being updated at each read.
0 Kudos
Message 7 of 9
(4,200 Views)

Well, one thing you did not do was change the data type wire into the Obtain Queue. You have a 1D dbl array and it should be a 1D Waveform array. Right click on the output of the DAQmx Read and select Create Constant. This is what you want to wire in.

 

Look at the shipping example called Cont Acq&Graph Voltage - Write Data to File (TDMS).vi.

Message 8 of 9
(4,198 Views)
Solution
Accepted by topic author bassinbc
When I did as you suggested, created the waveform constant and wired it to the queue, all was well. This one had been a tough one for me, but you nailed it. Many thanks.
0 Kudos
Message 9 of 9
(4,184 Views)