LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

decimating a 1 D array of waveform into 4 sub-arrays of waveform and display them

Hi:
As a beginner of LV I have encountered yet another problem:
The "AI Read" will output 1 D array of Waveform in this VI (from LV 6.0 examples)provided below. I want to decimate this array into 4 sub-arrays(a1, a2, a3, a4) using the "Decimate 1 D Array" function and display them on 4 parallel waveform graphs. However these 4 waveform graphs are empty when excuted, what's wrong?
My ultimate goal is to have and display (a1 subtracts a2) and (a3 subtracts a4) while assuming a1,a2,a3 and a4 have the same t0 and setting the appropriate dt. How do I accomplish this? Should I use "Get Waveform Components"?
And please clarify that the usage of waveform graphs, namely, what type of ar
rays can I feed to the waveform graphs? And also does the "subtraction function" take 2 waveforms as inputs? Do I have to use "Get Waveform Components" and recontrusct the data that way?
Thanks for reading this post
Regards, Alan.
0 Kudos
Message 1 of 7
(2,904 Views)
Hi Alan,
I think your "Decimate 1D Array" is not the correct VI to use in your case. What I recommend you is replacing this VI with "index Array" (0,1,2,3) and you'll have your 4 waveforms.
If you then want to substract two waveforms be sure that they've got the same "dt" otherwise you'll get a -1802 error. Use the waveform stock VIs in the fonction palette to do that.

Waveform graphs can be fed with 1D array of DBL, Single waveform, 2D array of DBL. See in the example Waveform graph.vi.

Hope this helps !
Julien
Message 2 of 7
(2,904 Views)
Hi Julien,
I tried using "Index Array" (0,1,2,3) and
only the first waveform shows up while the other 3 are still empty. I am a little confused how AI Read ouput the 1-D waveform data in this"Acquire N - Multi-Digital Trig.vi" example. Let's say I set the number of scans to acquire to 4,for every new triggered loop, will the array get updated/replaced(so the size of the array is always 4) or new values will be accumulated and the array keeps growing in size.
By the way can this example vi even be used for continuous triggering? You can see my goal is that whenever there is a positive edge, I want to acquire 4 samples, stop and then wait till the next positive edge.
0 Kudos
Message 3 of 7
(2,904 Views)
Did you check that the array "Channels" was set to a1|a2|a3|a4 (4 elements) when using "AI CONFIG".
If you do that you'll have a new array of 4 waveforms when using "AI Read".
When I open your VI I only have a1 in the array and that could be why you've got only one channel when using "AI Read".

For every new triggered loop, the array will get replaced (so the size of the array is always 4) : Correct.

I think your example is all right for continuous triggering.

Hope this helps !
Julien
0 Kudos
Message 4 of 7
(2,904 Views)
Hi Julien:
Thanks for the quick replies. But my goal is to
demodulate 1 analog input channel into N sub-channels. For example, if the array has index 1....M, then the first channel will get indexes 0, N, 2N, 2nd channel will get indexes 1, N+1, 2N+1...and so on. In my previous example N = 4 and I can split up the 1 analog input channel into 4: a1, a2, a3 and a4. But since DAQ board only has limited number of analog inputs that will be a problem for bigger N.
Is it possible to demodulate into N-sub channels with only 1 analog input?
Thanks a lot, Alan
0 Kudos
Message 5 of 7
(2,904 Views)
All right Alan,
I'm really sorry for my misunderstandings (Don't be upset for that, I'm probably a bit too confident with my English which is probably really bad in fact).

What you need to do is DECIMATE the array but in the first waveform.
1. Directly after your "AI Read" use the stock VI "index array" (index 0)
2. then use the stock VI "Get Waveform Components" and select "Y".
3. You can now decimate this array into 4 subsets.
4. These 4 subsets can feed 4 different graphs.

That's the way to do things if you don't really care about "t0" and "dt" that won't be visible on the graphs.

I hope I'm answering your question now. Feel free to tell me if I'm wrong once more. Sorry again !
Julien
0 Kudos
Message 6 of 7
(2,904 Views)
Thanks Julien for your time, I think I have figured it out.
I am really appreiciated. Alan
0 Kudos
Message 7 of 7
(2,904 Views)