05-28-2013 02:59 PM
Hello, I'm new here in Labview, and i have a little problem. I would like to known how I can collect points from a DAQ assistance, and make the average, and when I push a button, it stop to make the mean, and store the value.
I'm doing this using a case structure, however When I use the button, I can't save the valor of the average.
Can anybody help me? If I can solve this problem perhaps I can do a little project for my school \o
05-28-2013 03:01 PM
Can you post your code so we can see where you are at?
Since you are new, I would recommend going through some of the online tutorials:
05-28-2013 03:15 PM
here it is.I would like to store the value o the average, if you see the VI , i Think that you are going to understand what i'm trying to do
So, I've been looking for the solution of this problem, in basic Tutorials, but I couldn't find anything.
05-28-2013 04:41 PM
anybody?
05-28-2013 05:08 PM - edited 05-28-2013 05:10 PM
1. First of all, you need to initialize your arrays OUTSIDE the loop, otherwise you are re-initializing them every time and they are discarded every time unless you use a
2. Shift register. Add a shift register outside your loop (right click it). This allows your arrays to be passed to the next iteration of your loop. Look up shift register tutorial if you need help with that.
3. Finally, use Build Array. A basic model will be the picture I have attached.
I don't know how DAQ Assistant works, so I'm assuming you're correctly sampling data from its output.
Of course, there is still some work you will need to do. All the attached code is doing now is storing data in an array indefinitely util you hit stop. But it's a start.
You want to be able to click a button and get an average of what you have - and stop the daq assistant, I assume? Then just wire the "stop" button to a case structure, and take the average of the data coming out of the Build Array terminal. There's no need for two booleans here. Then you're done.
05-28-2013 05:53 PM - edited 05-28-2013 05:54 PM
There is no need to built an evergrowing array, (pontentially forever, just to run out of memory at one point). All you need is keep track of the running sum (a scalar!) and iteration count. Calculating the average is also very cheap, no need to do it only on demand.
Where do you want to "save" it? (to a file?)
How is the DAQ assitant configured? Are you taking single points or multiple points at a time? If you take multiple points, you can take the mean before further processing.
There is of course "mean ptbypt" which already does exactly what you want, but you can also roll your own, e.g. as shown in the picture below.
05-28-2013 06:14 PM
well for the time being i will like to say thanks for your help. I dont have much experience so any help it is very important. Actually i would like to store, the average of the points, in a array, And, when i press the button, i can store the last number of the average . Actually I would like to press the button , and my DAQ assistance still on working