LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Store changing numeric values to an array

Hi,

I am doing an experiment in which I need to record a numerical value. The numerical value can change and I wish to store the numerical value to an array every time it changes.

 

I have attached a VI I made which i hope explains what I mean. 

 

Thanks for your time. 

0 Kudos
Message 1 of 14
(11,487 Views)

Use shift register and build array.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

0 Kudos
Message 2 of 14
(11,484 Views)
This is what RavensFan mean.
Rodrigo Cuenca
www.cidesi.com

Message 3 of 14
(11,472 Views)
As far as Rodrigo's solution: Using equality/inequality operators on floating point values is a BAD idea. Especially on numbers that are the result of some computation. I'm sure we're going to see another post about "why can't LabVIEW correctly compare floating point numbers?". At which point I will have another nickel in my retirement fund.

0 Kudos
Message 4 of 14
(11,462 Views)
Thanks a lot, have a lot of study to do on shift registers!
0 Kudos
Message 5 of 14
(11,460 Views)

smercurio_fc wrote:
As far as Rodrigo's solution: Using equality/inequality operators on floating point values is a BAD idea. Especially on numbers that are the result of some computation. I'm sure we're going to see another post about "why can't LabVIEW correctly compare floating point numbers?". At which point I will have another nickel in my retirement fund.


 

I use (a modified version of) a VI that I borrowed from Moore Good Ideas called Approximately Equal.vi. This type of VI can be used to compare two DBL's to within, say, 0.1% of each other. I think it's handy. I have attached Approximately Equal.vi.

 

 

Richard






Message 6 of 14
(11,437 Views)

Broken Arrow wrote:

smercurio_fc wrote:
As far as Rodrigo's solution: Using equality/inequality operators on floating point values is a BAD idea. Especially on numbers that are the result of some computation. I'm sure we're going to see another post about "why can't LabVIEW correctly compare floating point numbers?". At which point I will have another nickel in my retirement fund.


 

I use (a modified version of) a VI that I borrowed from Moore Good Ideas called Approximately Equal.vi. This type of VI can be used to compare two DBL's to within, say, 0.1% of each other. I think it's handy. I have attached Approximately Equal.vi.

 

 


That's a nice VI. Here is amodified version which allows you to specify the tolerance.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 7 of 14
(11,423 Views)

Hi,

I created a VI that saves the measure values from a load cell into an array from. I have set certain parameters and by changing them also changes my output array. I want to store these new values in array into a new row while the previous values are still stored in upper rows. 

I have the attached VI. 
I want that if I change the parameters, the new values are stored in new row without changing the previous values.
Help needed urgently. 


0 Kudos
Message 9 of 14
(10,796 Views)

You should have started a new message thread.  This one is over 2-1/2 years old.

 

It's not clear what you are trying to do or why you wrote your VI the way you did.  You have a 7 iteration for-loop within a while loop.  You start with an array of zeroes size 15 by 7 every iteration, then proceed to use insert array to put values you into which makes your array grow while still having a bunch of zeroes in there.  (Insert into Array is almost always the wrong function to use.  Build Array is the better function 99% of the time.)

 

Your 7 iteration For Loop is going to put in the same data 7 times.  Actually it is kind of undetermined.   Becuase of the abuse of local variables, you have a race condition.  So you are entering either 7 stale values from another iteration, 7 values from the current iteration, or some combination of stale and new values depending on what code wins the race.

 

If you want to do something enter new data in the array as each loop of the outer while loop executes, then you should have your array being build with a shift register on the outer while loop rather than starting with a new array every iteration.

0 Kudos
Message 10 of 14
(10,790 Views)