From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
05-13-2014 02:39 PM - edited 05-13-2014 02:43 PM
Hi guys, i have a problem with Mean. I make an acquisttion and want use the mean of ten firsts point like one single point to start the rest of my test, but i cant stop the mean calculation on 10 point, the vi continues run. I wish to use the mean fo 10 points linke one single poit, and continue the acquisition normally in 11 and after. Can anyone help me?
Follow my VI in LV 2010
Solved! Go to Solution.
05-13-2014 07:18 PM
You need a case structure rather than a sequence structure. When i < 10, do the mean calculation. When i >= 10, append to the array. You almost never need sequence stuctures in well-written LabVIEW code.
I have modified your program to show how this can be done.
Note that the array in this modified program grows very large, very fast! This is because you increase the number of points acquired on each iteration. I doubt that is what your real program will do, but it is what you have programmed in this demo.
I changed the count to integer data types. I replaced your feedback node with a shift register. There is no particular advantage - just my personal preference. I replaced the Add 1 with Increment.
Lynn
05-14-2014 08:48 AM
Hi Kossmann,
About your program that you attached in your message, would you mind to clarify some things about it?
Let me see if I go it straight, you want to make the mean of the first 10 values of your application, and consider that calculated value your first acquisition, after that the 11º value will be the second in your acquisition, the 12º value will be the third in your acquisition and so on?
For example, let's say that your values are as shown below:
GENERATED VALUES
1º 2
2º 3
3º 2
4º 3
5º 2
6º 3
7º 2
8º 3
9º 2
10º 3
11º 5
12º 6
.
.
.
YOUR ACQUISITION
1º 2,5
2º 5
3º 6
.
.
.
The values for your program are generated for this part of your code? (See Attachment "Generation of Values.jpg")
05-14-2014 09:39 AM
@Kossmann wrote:
Hi guys, i have a problem with Mean. I make an acquisttion and want use the mean of ten firsts point like one single point to start the rest of my test, but i cant stop the mean calculation on 10 point, the vi continues run. I wish to use the mean fo 10 points linke one single poit, and continue the acquisition normally in 11 and after. Can anyone help me?
Your code is extremely convoluted with all these inner FOR loops and useless sequence structures, etc.. Simplify!!!
Try to start with some tutorials first.
Use mean-ptbypt for the first 10 values, append to the array of you have 10 values, then start appending single values. Here is a quick draft.