LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do something every time I have a new Max Value

Solved!
Go to solution

So I'm trying to implement a Hill Climbing Algorithm on a set of 10 motors.I run one motor at a time and increment it in small steps and take power readings from them. All my power readings go into an array. Now each time I find a maximum in the Array I want to perform some functions (read all the motor positions and save them). How do I do something every tiume I find a new maximum. I'm using the Max Min Array Function. A VI is attached for further reference. It's not the whole thing but a part of the entire code. 

0 Kudos
Message 1 of 3
(158 Views)
Solution
Accepted by topic author bajajvishal11

Hi bajaj,

 


@bajajvishal11 wrote:

How do I do something every tiume I find a new maximum.


You  already know how to use shift registers: store the "max" value in a shift register and compare it in the next iteration with your "new max" value to determine your condition…

 

Btw. you don't need to build an array just to determine max values: just keep the latest "max" value in the shift register and compare with current "reading" using a MinMax function!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 3
(152 Views)

Thanks a lot. Now that you say it it's very easy. But sometimes I just have this code block, where I don't know what to do. 

0 Kudos
Message 3 of 3
(147 Views)