The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Revaluing after using "break"

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

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

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000