Sign in to follow this  
rcbarend

Finding the lowest of multiple variables

Recommended Posts

Hi,Does anyone know of a neat way to find the lowest in a group of variables?I.E I have 5 variables with different values and I need to pick the lowest value at any given time.Any ideas?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Hi Paul,This is what first came in mind: (maybe not the most efficient:-))(L:Var1,number) (>L:VarMin,number) (L:Var2,number) d (L:VarMin,number) < if{ (>L:VarMin,number) }(L:Var3,number) d (L:VarMin,number) < if{ (>L:VarMin,number) }(L:Var4,number) d (L:VarMin,number) < if{ (>L:VarMin,number) }(L:Var5,number) d (L:VarMin,number) < if{ (>L:VarMin,number) }Use (L:VarMin,number) as referenceHope this helpsTom

Share this post


Link to post
Share on other sites

Tom,Much more efficient than the route my brain was going!Many thanks,

Share this post


Link to post
Share on other sites

Hi Paul,Glad it was useful! If you need to handle Var1..Var5 independent from VarMin within a gauge, you can use a macro:(L:Var1,number) s0(L:Var2,number) d l0 < if{ s0 }(L:Var3,number) d l0 < if{ s0 }(L:Var4,number) d l0 < if{ s0 }(L:Var5,number) d l0 < if{ s0 }l0And then check the VarMin Value ie:..@VarMin 10 < if{ XXX } etcCheersTom

Share this post


Link to post
Share on other sites

Euhh....What's wrong with:var1 var2 var3 var4 var5 min min min min :-) ??Cheers, Rob Barendregt.

Share this post


Link to post
Share on other sites

"What's wrong with:var1 var2 var3 var4 var5 min min min min :-) ??"I can't see anything. Should be something??:-lol:-lol:-lolCheersTom

Share this post


Link to post
Share on other sites

Ok thanks... Sorry for being thick but what does min do?

Share this post


Link to post
Share on other sites

Paul,min takes the smallest of two values. ie "10 12 min" returns 10.What Rob showed seems to be the most efficient way I was talking about :-)Regards,Tom

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this