LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to collect 100 different value from DAQ and get average of it

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

Untitled.png

0 Kudos
Message 1 of 10
(4,421 Views)

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.

0 Kudos
Message 2 of 10
(4,418 Views)

Yes, I am using DAQ assistant, the VI is attached to the post.

Capture.JPG

 

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?

0 Kudos
Message 3 of 10
(4,410 Views)

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>   ---'


0 Kudos
Message 4 of 10
(4,405 Views)

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

0 Kudos
Message 5 of 10
(4,397 Views)

And can I keep 1000 "Sample to read", but only take 100 for mean.vi? How can I do it?

0 Kudos
Message 6 of 10
(4,380 Views)

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.

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

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>   ---'


0 Kudos
Message 7 of 10
(4,369 Views)

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.

0 Kudos
Message 8 of 10
(4,365 Views)

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.

0 Kudos
Message 9 of 10
(4,353 Views)

@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.

0 Kudos
Message 10 of 10
(4,351 Views)