06-26-2011 02:03 PM
Hi There,
I have a VI that running an electromganet using a DAQ device (not shown in the attahced but the simulator is shown). The measurement data (voltage vs field) are not taken by DAQ and instead the voltage istaken by keithley and the field is taken by a gaussmeter (both are represented in the attached by two random number generators). Although everthing is fine with this code, the noise is somehow high and therefore I have to take average of two or three loops.
Basically what I want is to make the VI in the middle of the sequence strucutre run three times and then taken the average which should be shown in another XY graph and be written to an excel file. Any help in doing that will be really appreciated.
Hadiq
06-26-2011 05:42 PM
This might do what you want. Signal In goes into Signal Out, with the previous value and the one before that "memorized" on the shift register. Simply adding these three together and dividing by 3 gives you a running average of the current point and the previous two points.
06-26-2011 06:04 PM
All you need is mean ptbypt with a sample lenght of 3.
(However, a lot of your code makes very little sense or is meaningless. Why are you autoindexing over empty arrays in a while loop???)
06-27-2011 03:13 AM
Thank you Bob and Altenbach for providing me with how to do the mean average. Most importantly, however, is how to run the loop three times, indexing data and then taking the average.
06-27-2011 08:39 AM
I got an idea to run three cascaded loops by putting the while loop inside a for loop and then set (N) the count of terminals to 3. Although the VI gets complicated but it works. Now, can help me in sorting the average of the three loops and how two write them to an excel file. There is an error coming to me each time about dublicating the measurement file.
06-27-2011 08:42 AM
Hi Bob,
Do I need two of them for the data coming from keithley and the data coming from the gaussmeter.
06-27-2011 09:04 AM
If your data are coming in at the same rate and within the same loop, you can simply make a taller While loop, have Keithley In and Gaussometer In, a separate set of shift registers for each, and Keithley Out/K Avg Out and Gaussometer Out/G Avg Out outputs.
BS