05-15-2017 09:13 PM
1. If those signals are on the same DAQ card, they will need to be in 1 task. Which means you will only have 1 DAQmx Read (configured for N Samples, N Channels). You can use Index Array to separate the waveforms.
2. Use a FOR loop and Mean.vi to average the two samples.
3. Use Build Array to build up an array of waveforms. That array can then go to your chart and have all of your plots together.
05-16-2017 12:00 PM
Thank you again. I think we are almost there.
My only (perhaps last) concern is that even though I have given the length of average as 180 samples, the average signal starts almost as soon as the real signal.
Should not the average signal start only when the 180 samples are collected.
The timed loop has 1000 ms time period.
Please see the pictures attached.
Thank you so much again for your guidance. I cherish your advice a lot.
05-16-2017 12:21 PM
Please use block diagram cleanup. There are too many tangled and backwards waveform wires.
Get rid of the constants on index array. They will give you elements 0, 1, 2, 3, .... by default if unwired.
You could put the waveform chart in a case structure so it only updates once 100 iterations have passed. Or feed it NaN until 100 iterations have passed. Or you could initialize the point by point with 100 elements of the first data point to fill the buffer. It all depends on what you want to have happen until the first 100 iterations have passed.
05-16-2017 01:01 PM
If you want a running average in real time, use something like this (which averages 5 samples):
05-16-2017 02:53 PM
To add to what RavensFan stated, stop using the From DDT. It is literally doing nothing for you here.
And didn't I tell you to get rid of that Timed Loop?
As far as the averaging, that is just how the function works. It sums up to your desired number of samples and divides by that number of samples. If you want to ignore them, use a case structure. It would be easier if you just read the number of samples you want in the average each iteration and then you just have to not update on the first iteration. Again, do not use a Timed Loop if you do this.