02-22-2020 08:59 AM
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.
02-22-2020 09:10 AM - edited 02-22-2020 09:11 AM
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...").
02-23-2020 03:25 PM - edited 02-23-2020 03:26 PM
Here's a skeleton of a possible solution:
02-23-2020 10:50 PM
Thank you for the reply. It is actually helpful.