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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Revaluing after using "break"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

eno

Japan
34 Posts

Posted - 03/07/2005 :  12:59:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 03/07/2005 :  08:26:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

eno

Japan
34 Posts

Posted - 03/07/2005 :  11:57:18 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It works well.
Thank you very much!

eno

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000