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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

array of element to a scalar value ( single numeric vaue)is there

guys,

 

i'm sampling voltage values from daq which are in the form of 1D arrays.

but i need them in a single numeric value.

for example, i've sampled 10 values at an instant and these ten values occupy 10 places in an array at that instant.

but i want all these values to a numeric constant, in which these values will change in that nmeric constant for some given time interval.

a[]=[2,1,3,4,5,6,7,8,3,4]. but i want a=2 for 2 milliseconds, a=1 for the next  2 milliseconds, a=3 for the next 2 millisecond interval and so on.

 

is there any conversion block to do this or an logic for this.

0 Kudos
Message 1 of 11
(3,098 Views)

It's a bit difficult to understand which part of the process you are trying to figure out.

 

Are you trying to have a 2ms period for your sample rate instead of 10 values instantly? e.g. 10 values that cover 20ms total time

You are saying "numeric constant", but it's unclear what you mean by that.

Are you just trying to plot the 10 values with an associated timestamp? Like a waveform?

Rather than plot, are you just trying to have a numeric indicator that shows you the values one-by-one in the array? If your DAQmx is set up right, you will have a sample rate (500Hz?) that will output these values every 2ms.

Am I wrong about all of the above and you're actually trying to output 10 data points with each datapoint every 2ms?

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 2 of 11
(3,090 Views)

I think what you need is a simple for loop. Do whatever you need with "a"...?

array.png

0 Kudos
Message 3 of 11
(3,077 Views)

dear james morris,

yes. i need to read value from the array one element by one element 

0 Kudos
Message 4 of 11
(3,060 Views)

trip, looking at your other post, why don't you just do an average of the 10 values to get your indicator value? This will be a more accurate representation of the array of values since you have them all already. The user won't be able to tell the difference between each value if you write them at 2ms periods.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 11
(3,052 Views)

dear james morris,

 

how to take average of the sampled values.

shall i divide the values with the array size?

will it work?

0 Kudos
Message 6 of 11
(3,041 Views)

@triptathakur wrote:

how to take average of the sampled values.

shall i divide the values with the array size?

will it work?


 

You can do that if you want (Add array elements and then divide by original size), or you can use the handy Mean VI.

Mean10_BD.png

 

It sounds like you could use some tools to become more familiar with what LabVIEW is capable of. Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.

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


Message 7 of 11
(3,037 Views)

i mean, shall i take the index array to sample the values and take the average of them by dividing with array size.

is this what you are saying about?

then what about the index value?

 

0 Kudos
Message 8 of 11
(3,033 Views)

What do you mean by "index value"? Don't you just need to display the data? Just take the Mean value like above and write that to your indicator.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 9 of 11
(3,025 Views)

dear james,

yeah i got it.

i have to use summation of array elements and divided by array size.

if it cope up with my logic, i'm so thankful to you

0 Kudos
Message 10 of 11
(3,012 Views)