LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

trigger, then statistic, hold until next trigger

i am triggering a temperture waveform. after the waveform is triggered i am attempting to capture the Mean of the temperture after it was triggered. The problem i am having is that eventhough my waveform stays on the graph until the next trigger, my mean shows average for a moment then returns to zero.
i have tried doing the statistic in a loop but i cant figure out how to make it hold the data until the next trigger.

Message Edited by ccabuto on 05-19-2005 04:57 PM

0 Kudos
Message 1 of 2
(2,489 Views)
Salutations,

It says here you're extracting the median and arithmetic mean (front panel says running average- discussed later on).

Mean (aka arithmetic mean) = Sum of all the number in a data set divided by the size of the data set.
Median = Middle most number in the data set (even data sets, use mean of two middle most numbers).
Mode = Most frequent number in the data set.
(Those are my own definitions -i'm sure plenty of others as well, however it might not be the perfect one).

As far as statistics go, using the median is an excellent way to avoid skewed data bias, which can severly hinder the mean. You can always remove outliers, to improve the mean calculation. Alrighty then! Statistics is evil, and well, I'm not such a large fan of it. So, best of luck there.

To solve your problem with the magical mean disappearing act, use an event structure. When you trigger an event in the structure, it'll run through that event. You can think of an event structure like a Sub VI. It will continue until something stops it, or it's finally done with the desired task. If you use an event structure, you'll collect the mean (make sure you read the help on event structures, it'll give you a solid idea).

Currently, your while loop is executing every 200 milliseconds. So i'd imagine your taking the average of nothing a lot.

If you don't want to use an event structure, you should be able to use shift registers that will continue to paste the same number until the calcuation is updated and the number is switched.

If you're attempting to do a "running average" i'm assuming that's a "moving average". It doesn't look like you're doing that. A moving average normally has a period (unless you want it to last forever), which takes in so many points (lets say 9) and then starts to kick out the last number as a new one enters. For small periods you could use shift registers. Not the most pretty event, so i'd suggest using something like the quotent remainder approach (moding).

Lastly, you've got a "stop" then a "not" button that links to the stop of the while loop. Why not just make the while loop stop button red? Then remove the not function. It's an unnecessary step.

I hope this helps you out, I'm still a little confused as to all your processes, however I believe (hopefully) this will put you on the right track to finding out the issue.

Sincerely,
ElSmitho (note: i don't have all the sub vi's you've got in there, so i can't run your vi and check it out piece by piece).
Message 2 of 2
(2,475 Views)