Find Maximum in a Table
Posted: Thu Jun 30, 2011 3:36 pm
I have this program to find a maximum in column 1 with 5 rows, and finally highlight the maximum yellow:
Problem: It works well when all numbers are greater than 0. However, once a number is less then 0 (e.g. -0.23443) then it will fail to work. I wonder why does it fail to work? As far as I know 2>1 as well as 2>-1.
Code: Select all
'find highest values
for !i=1 to 5
!r=0
for !j=1 to 5
if table_a(!i,1)>=table_a(!j,1) then
!r=!r+1
endif
next
if !r=5 then exitloop
endif
next
table_a.setfillcolor(!i,1) yellow