09-03-2015 04:11 PM
I am using USB6009 connects with two pressure transducers, one voltage meter, and one current meter; I am trying to have the program to get average of each of pressure, current, and voltage, from 100 values right after I click on the start swich on case structure. My question is how can I tell the program to collect 100 values for each? Thanks
09-03-2015 04:17 PM
You don't show any of the DAQ stuff. I imagine you are using a DAQ assistant?
Generally you tell it to collect 100 samples when you are doing the DAQ read.
09-03-2015 04:23 PM
Yes, I am using DAQ assistant, the VI is attached to the post.
Do you mean change "Samples to Read" to 100 then the mean would know to take all 100 sample to get the average?
Do I have to put anything to tell mean.vi I want to take 100 samples in between DAQ assiant and mean.vi?
09-03-2015 04:30 PM
The Mean VI outputs the mean of all of the elements of the array that you give it. So yes, if you read 100 samples and run them through the Mean VI, you will have the mean of all 100 samples...
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-03-2015 04:43 PM
I had the converts inside the case structure, so everytime I click on the switch to get average numbers, the program gives me the same number as the display shows without mean.vi, which means there is only one number goes through case structure into mean.vi. Now I take converts out of the case structure so it would convert the signal to number of samples before it enter the case structure, so mean.vi would receive all the samples that DAQ generate and get the mean. Please correct me if I am wrong.
I just want to make sure I am on the right track, since it is hard for me tell if it is taking the average by the number.
Thanks
09-03-2015 04:53 PM
And can I keep 1000 "Sample to read", but only take 100 for mean.vi? How can I do it?
09-03-2015 05:01 PM
It sounds like you need some basic LabVIEW training because you're struggling to understand how to manipulate an array of data. That thick orange wire is an array of double precision floating point numbers. The array of DBLs goes in to the Mean VI and out comes a thinner orange wire. The thin orange wire is only one DBL because the VI took the array, ran an average operation on the array, and output the mean. If you want to get a mean of a smaller section of the array, there is a function called Array Subset in the palette.
Why would you want to run a mean on only a small section of your data instead of the whole? Seems weird, but it's up to you.
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe." - Abraham Lincoln
Here are some free training tools primarily focused on LabVIEW and NI hardware to help.
-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)
Learn NI Training Resource Videos
6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
09-03-2015 05:02 PM
If you have 1000 samples and want an average of a 100, does that mean you want 10 averages? Or average of the first 100? or average of the last 100?
The answer to all of these is probably some array manipulation (Delete from array gets last 100, or first 100) and a for loop running 10 times getting 100 sames each then averaging them is for the other option. Please be more specific.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
16 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
09-03-2015 05:16 PM
Thank you all.
I got it now.
I wanted 100 samples for average, I thought it would make the calculation goes faster, and 100 samples sounds enough for me.
It is great to know about Array Subset, I am still learning Labview.
09-03-2015 05:16 PM
@uwe038 wrote:
I had the converts inside the case structure, so everytime I click on the switch to get average numbers, the program gives me the same number as the display shows without mean.vi, which means there is only one number goes through case structure into mean.vi. Now I take converts out of the case structure so it would convert the signal to number of samples before it enter the case structure, so mean.vi would receive all the samples that DAQ generate and get the mean. Please correct me if I am wrong.
I just want to make sure I am on the right track, since it is hard for me tell if it is taking the average by the number.
Thanks
What is "converts"? Are you talking about the Blue Express VI that takes the blue dynamic data wire and outputs an array of doubles?
It doesn't matter whether they are inside or outside of the case structure, they are going to do the same job.
I don't know what you mean by the program gives the mean as the same number as the display since you haven't shown any front panel displays.