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: 

Counter To Array

Hello,

 

I have a numeric control that constantly changes value.

I want to create a 1 row array of all these values.

The array should contain the last 10 changes from the input and can delete any previous values.

 

If for example my numeric control is a counter from 1 to 100. (1 2 3 4 5 6 ... 98 99 100)

My array should always contain the last 10 digits

Array after first 10 counts = 1 2 3 4 5 6 7 8 9 10

Arrey in the middle = 43 44 45 46 47 48 49 50 51

Array at the end = 91 92 93 94 95 96 97 98 99 100

 

Any ideas?

 

Thank you in advance.

 

0 Kudos
Message 1 of 5
(2,411 Views)

Hi KLI,

 

I would rather suggest you to store the counter values into queue and

in a separate loop, dequeue it and build into array.

 

Regards,

 

Prashant

0 Kudos
Message 2 of 5
(2,409 Views)

And how should I do that specific?

 

I'm fearly new to Labview and most of the time I know what should happen,

I just can't implement cause i'm not familiar with the functions and how to implement them.

0 Kudos
Message 3 of 5
(2,405 Views)

Found the solution myself.

 

For Loop with n=the number of values in the 1D array. (10)

Use auto indexing to an Array indicator.

 

I just have timing difficulties now.

 

Is there a possibilty to only store the value into the array at the moment it changes value instead of timed by the for loop iteration?

0 Kudos
Message 4 of 5
(2,402 Views)

KLI wrote:

Is there a possibilty to only store the value into the array at the moment it changes value instead of timed by the for loop iteration?


Yes.

 

(what is "constantly". How different to they need to be to be considered changed? Where is the value coming from?

 

 


@KLI wrote:

For Loop with n=the number of values in the 1D array. (10)

Use auto indexing to an Array indicator.


That does not make a lot of sense. Can you show a picture of your code?

0 Kudos
Message 5 of 5
(2,388 Views)