| Author |
Topic  |
|
|
sjwu77
USA
Posts |
Posted - 11/28/2004 : 03:48:25 AM
|
Hi there,
I'm confused by this problem:
I tried to call a script and pass a number (say, 3) to the file, as
run.section(myScript,Main,3);
In my Script, 3 is used to make the name of a worksheet [Main] ... %I=data$(%1); ...
Then some data manipulation is performed. Everything seems to be fine.
Now I try to run the scripts with a sequence of numbers as argument:
for (num=1;num<=10;num++) {run.section(myScript,Main,num);}
The labTalk seems always perform the last one, e.g., num=10, and do nothing to num from 1 to 9...
Could anyone help me to figure out any possible problem here?
Thanks a lot
Saijun
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 11/28/2004 : 08:20:32 AM
|
Hi Saijun,
The problem must lie in your [Main] scripts. To verify, change them to this...
[Main] type $(%1); return; ...
I will be very surprised if you don't see this...
for (num=1;num<=10;num++) {run.section(myScript,Main,num);} 1 2 ... 9 10
Mike Buess Origin WebRing Member |
 |
|
|
sjwu77
USA
Posts |
Posted - 11/28/2004 : 3:19:03 PM
|
Hi Mike,
Here is my subroutine:
myScript.ogs ////////////////////////////////////////////////////// [Main]
pts=50; curve.reset(); curve.smoothleftpts=pts; curve.smoothrightpts=pts; curve.smoothpts=2*pts+1; %I=data$(%1); type %I; // I add this line as you suggested curve.x$=%(%I,1); curve.data$=%(%I,2); ; curve.result$=%(%I,3); curve.adjave(); sum(%(%I,3)); return;
///////////////////////////////////////////////////////// run.section(myScript,Main,1) gives data1 and correct data smoothing as I expected
When I run for (num=1;num<=3;num++) {run.section(myScript,Main,num) gives: data1 data2 data3 However, the data smoothing only happen at the worksheet "data3"!
If, I manually input run.section(myScript,Main,1) and run run.section(myScript,Main,2) and run run.section(myScript,Main,3) and run The data1,2,3 are smoothed accordingly.
If, However, I select the three line altogether and run at once, same thing happens as when I use the for loop...
Any further suggestion? Thanks a lot
|
 |
|
|
Mike Buess
USA
3037 Posts |
Posted - 11/29/2004 : 08:40:04 AM
|
An extra semicolon is delaying execution...
curve.data$=%(%I,2); ;
Remove the 2nd semicolon and your script will work fine.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 11/29/2004 08:58:09 AM |
 |
|
|
sjwu77
USA
Posts |
Posted - 11/29/2004 : 1:16:25 PM
|
all right. I never thought of ";" It works now thanks a lot Mike |
 |
|
| |
Topic  |
|
|
|