01-11-2016 11:37 PM - edited 01-11-2016 11:40 PM
As I said, you don't need any inner loop. the shift register needs to reside on the outer loop. Currently, you are reinitializing the shift register with an empty array every time the inner loop is called.
01-12-2016 07:46 AM
HI Christian,
I am sorry to keep troubling you with this, but I am still having difficulty with this VI. I went through and only connected the shift register to the outer while loop and removed the inner FOR loop with the mean sub-vi. I tried a few variants of these steps but couldn't figure out where to wire certain things.
1. When I wired the shift register to only the WHILE loop, I could not figure ouut where to wire the top terminal of the "Replace Array Subset" . I would have thought that it should have been the 0 element array and the new element should be my input waveform.
2. I removed the FOR loop with the Mean in it, and tried to wire everything up both with and without the Mean sub-VI. Neither worked. When I did not use the Mean sub-VI, in the WHILE loop I tried to use an Index Array (and a Reshape Array as well) to convert the 2D array to a 1D array so I coulf plot it. No dice. When I tried to use the mean sub-VI, I could not wire it without an auto-indexing FOR loop, as the output of the Mean sub-VI is simply a number.
An example code of what you were trying to describe would be must helpful. To that end, I have included a broken version of the code I was trying to modiy with your suggestions. I will be venting this insturment to make needed hardware repairs (oh joy!) but will work on this during my lunch break. Thanks again for the help.
Joe
01-12-2016 12:41 PM
Just did some tests on the VI and found I had a few indexes flipped. Here is an example of the VI in use. I recommend just using the VI as is and adding it to your project as a subVI.
01-12-2016 08:14 PM
Hi Tim and Christian,
Thank you both very much for your help. With a bit of extra work (and coffee!) I was able to get everything to work. I marked it as a solution and gave you both kudos. Once again, many thanks!
Joe
10-03-2016 11:51 AM
Attached is a simple demo using lossy queues to keep an array for doing a rolling average.
Open "Using Rolling Average.vi" and run it.