LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get the maximum index of a growing vector

Solved!
Go to solution

Hi,

 

I'm having a very weird issue. I simulate data with a sinus function in a while loop and i keep the values < 0.7 into a vector. When the sinus values are over 0.7, I remove the vector. etc.

I would like to get the maximum index of the vector at each iteration of the loop. Nevertheless, i get an index equal to zero while the vector has a size > 0.

This is really strange because if I put the values of the iteration instead of the values of the sinus, the founded index is correct (the only difference is that the iteration number is an integer while the sinus is a decimal number).

Do someone understand something ?

 

Thanx for your help

Andrew

 

 

0 Kudos
Message 1 of 3
(2,670 Views)
Solution
Accepted by topic author andrew_ryan

Instead of "delete from array", just leave the TRUE case empty and "use default if unwired" on the array output tunnel.

 

Once the sine is again <0.7, you are on the descending branch, so the first element is always the largest for a while. Nothing wrong with that.

 

I would also place the indicators after the case structure so they update under all conditions.

 

Array min&Max will give you the index of the element with the largest value. If you want to know the size of the array, use the "array size" function.

0 Kudos
Message 2 of 3
(2,655 Views)

Thanx for your answer. Everything is clear now!

0 Kudos
Message 3 of 3
(2,640 Views)