LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign values to index after index periodically of an array?

HI,

I have a very basic question to ask. Actually I am having min max array in my code. I want to use the max value to this array for building another array (array2). This min max array is inside a a loop. So, the max value is changing after every cycle of the loop. Now I want to assign the max value of first cycle to the first index of array2, then the max value of second cycle to the second index of array2 and so on.

Basically each time, the number should go to the next index of array 2. In that way I can build an array with the max values (in all the cycles of loop) to the indices in sequence. 

Actually I need the max value of min max array (which is in a loop) in a waveform chart/graph in live mode. Can somebody please help?

Thanks in advance.

0 Kudos
Message 1 of 4
(1,809 Views)

Hi Ben,

 


@Ben121 wrote:

I want to assign the max value of first cycle to the first index of array2, then the max value of second cycle to the second index of array2 and so on.

Basically each time, the number should go to the next index of array 2. In that way I can build an array with the max values (in all the cycles of loop) to the indices in sequence. 


Yes - use an autoindexing For loop (or right click on a While loop tunnel and set the mode to Indexing) and then you'll get one value per iteration.

 


@Ben121 wrote:

Actually I need the max value of min max array (which is in a loop) in a waveform chart/graph in live mode. Can somebody please help?


To update the value in the chart/graph every iteration (live mode, as you called it), you need to write values to it every iteration. That means it has to be inside the loop.

With a graph, you'd do this using a Shift Register and something like "Build Array", but it's much simpler in this case if you simply use a Chart.

 

Charts store history automatically (unlike graphs, which update to whatever you write to them each time - no memory of previous writes) up to the limit you set (right click on the chart and choose "Chart History Length...").


GCentral
0 Kudos
Message 2 of 4
(1,804 Views)
  • Do you know he number of iterations (i.e. the final size of array2)?
  • Where do the original arrays come from?
  • Is it sufficient to see the array of max values after the loop has finished, or do you want to see it as it builds?
  • ...

 

Here's a skeleton of a possible solution:

 

altenbach_0-1582493127382.png

 

0 Kudos
Message 3 of 4
(1,744 Views)

Thank you for the reply. It is actually helpful.

0 Kudos
Message 4 of 4
(1,727 Views)