| T O P I C R E V I E W |
| eno |
Posted - 03/07/2005 : 12:59:29 AM Origin Version: 7.5SR5 Operating System: Win 2000SV
When I use "break" command in the fllowing script, the variable "end" can NOT be revalued in the second loop(ii). What's a problem?
first=1; for(ref=5;ref<=20;ref+=5) { loop(ii,first,wks.maxrows) { if(%(data1,2,ii)>=ref) { end=ii-1; break; }; }; set col(2) -bs first; set col(2) -es end; sum(col(2)); type "firsti=$(first) endi=$(end) ref=$(ref) mean=$(sum.mean)"; first=end+1; };
eno
Edited by - eno on 03/07/2005 01:13:33 AM |
| 2 L A T E S T R E P L I E S (Newest First) |
| eno |
Posted - 03/07/2005 : 11:57:18 PM It works well. Thank you very much!
eno
|
| Mike Buess |
Posted - 03/07/2005 : 08:26:24 AM I created two worksheets, Data1 and Data2, and filled column 2 of each with row numbers. Running your script when Data2 is active gave this result which looks correct...
firsti=1 endi=4 ref=5 mean=2.5 firsti=5 endi=9 ref=10 mean=7 firsti=10 endi=14 ref=15 mean=12 firsti=15 endi=19 ref=20 mean=17
Running your script when Data1 is active gives this...
firsti=1 endi=4 ref=5 mean=2.5 firsti=5 endi=4 ref=10 mean=-- firsti=5 endi=4 ref=15 mean=-- firsti=5 endi=4 ref=20 mean=--
The second column of Data1 is used in the inner loop and when Data1 is active you are restricting the range of that column with the set -bs/-es commands in the outer loop. Your script works for both worksheets if you reset col(2) to full range...
set col(2) -bs first; set col(2) -es end; sum(col(2)); set col(2) -b 1; set col(2) -e wks.maxrows;
Mike Buess Origin WebRing Member |
|
|