Showing results for 
Search instead for 
Did you mean: 

timed average sub vi

Go to solution

I am trying to average sensor data by sending it to a sub vi i created, which will append an array within the sub vi every second, and then at the end of the set time, output an average over that time period and reset the array.  For some readon some of my data values are coming out very wrong.  Could there be someting wrong with this vi? Specifically, I am wondering if there is a problem with persistent data in the sub vi array..  I am running LabVIEW 8.5

0 Kudos
Message 1 of 4
Accepted by topic author hankthetank
08-27-2015 04:09 PM

You need to set you subVI to be reentrant.  Go to VI Properties->Execution.  There is a checkmark there for reentrancy.  If you can choose, you want to preallocate clone for each instance.


What this will do is each call to the subVI will have its own memory space.  It is currently sharing the memory space and therefore your averages are getting all messed up.


I would recommend visiting the LabVIEW Field Journal as there were some good articles this year on this subject matter.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 2 of 4

That fixed it right away. Great work, thank you!

0 Kudos
Message 3 of 4


0 Kudos
Message 4 of 4