09-10-2021 09:31 AM
Hi, everyone
i am stuck in programming Labview.
i build up an 1D array, meanwhile, there are data coming inside this array continuously.
then i set up array size to make sure if elements reach up to ,for example, 20.
At this point, i would like to stop elements coming in and make average. after that, i would like to delete the data and let new data keep importing inside the array.
i have tried 'initialize array', 'build array','delete array' and others but failed.
Does anyone have better solutions for this case?
Thank you in advance.
09-10-2021 09:36 AM - edited 09-10-2021 10:16 AM
@Maksim.wang wrote:
Does anyone have better solutions for this case?
Of course we do!
Once you attach your VI and explain exactly how you use it and what result you want, we can give specific advice.
@Maksim.wang wrote:
At this point, i would like to stop elements coming in and make average. after that, i would like to delete the data and let new data keep importing inside the array.
.
Maybe all you need is a ptbypt mean?
@Maksim.wang wrote:
i have tried 'initialize array', 'build array','delete array' and others but failed.
It does not matter what you use, it matters how you use it. You can't just randomly throw functions at a problem and see what sticks. Did you start with some basic tutorials?
If you have a fixed size array (assumingly in a shift regsiter), you would just overwrite the old data with the new data at the relevant position (e.g. using "replace array subset"). no need to delete anything, ever.
09-14-2021 02:41 PM
HI, thank you for your reply.
thanks for your suggestions.
however, i am not allowed to post it on here because this is one of the work from my company.
if you could have me an example IV, i would be really appreciated.
thanks in advance
09-14-2021 05:43 PM
There are way too many unknowns to give targeted advice. Did you try ptbypt mean?
You could also study this recent thread.
09-14-2021 06:03 PM
Hi, thank you for your respond
Yes, i have tried ptbypt mean. i set up a loop for data to keep coming in with this.
Now, i am still struggling with "stop the loop with ptbypt while data is coming in array, then make average before delete the old data from array and start to import new data"
your suggestion might be helpful. i will try it tomorrow.
thank you for your reply.
09-15-2021 01:06 AM
Hi Maksim,
@Maksim.wang wrote:
Yes, i have tried ptbypt mean. i set up a loop for data to keep coming in with this.
Now, i am still struggling with "stop the loop with ptbypt while data is coming in array, then make average before delete the old data from array and start to import new data"
Please follow this advice (as it is a very good advice from Altenbach!):
Once you attach your VI and explain exactly how you use it and what result you want, we can give specific advice.