05-14-2021 12:43 PM
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.
Solved! Go to Solution.
05-14-2021 12:56 PM - edited 05-14-2021 12:58 PM
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!
05-14-2021 12:59 PM
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.