Minimum Value in Array
Hello again all,
I am trying to choose the minimum value from an array. Do I need to manually go through and test each element, or is there some sort of function I am not yet aware of?
Ex.
array = 10, 2, 5, 1, 7, 8
Ideally, I would actually like it to return 3 here (the minimum value of 1 is the element number 3), but if it would return 1 I could easily look that up. Otherwise I'm using a loop similar to that below.
min = 0
For i = 1 to 6
if array(i) < array(min) then min = i
next
Thanks guys,
Xan
I am trying to choose the minimum value from an array. Do I need to manually go through and test each element, or is there some sort of function I am not yet aware of?
Ex.
array = 10, 2, 5, 1, 7, 8
Ideally, I would actually like it to return 3 here (the minimum value of 1 is the element number 3), but if it would return 1 I could easily look that up. Otherwise I'm using a loop similar to that below.
min = 0
For i = 1 to 6
if array(i) < array(min) then min = i
next
Thanks guys,
Xan

Comments
Post Edited (Mike Green) : 1/13/2010 4:56:08 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com