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
 [] brackets interrupt loop

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
J.S.Schulte Posted - 08/15/2016 : 12:15:54 PM
Origin Pro Ver. 2015G SR2:
Operating System: Windows 7 64 bit

Hi,

I use the following script-lines within a loop to output/copy calculated p-values from a Mann-whitney-test to respective result-sheets:
....
[%(resultate1$)]1!cell(zaehler,2)$=grname$;
[%(resultate1$)]1!cell(zaehler,3)=myMW.Stats.Stats.C3;
....
"resultate1$" is the string variable with the longname of the respective results sheet, "zaehler" is counted upwards during the loop and "grname$" holds the parameter-name for each p-value.

When executed directly in the script-window, everything works as wanted. Within a script-file the loop stops without an error message when reaching those lines. Is it possible that the lines are misinterpreted as sections because of []?
How do I have to change the syntax to get things running?
6   L A T E S T    R E P L I E S    (Newest First)
cqy2016 Posted - 08/18/2016 : 06:42:42 AM
quote:
Originally posted by yuki_wu

Hi cqy,

An example you can refer to:

//Get the current active workbook name
string bn$ = %H; 
//loop over all worksheets in the current workbook
loop(ii,1,page.nlayers) 
{
  //Add dataset into a specified graph layer	
  plotxy [bn$]$(ii)!(1,2) plot:=200 ogl:=[Graph1]1!;
}

Hope it helps!

Yuki
OriginLab



Hi Yuki,

Yes, it helped.
Thanks and best regards!

CQY
yuki_wu Posted - 08/17/2016 : 10:32:42 PM
Hi cqy,

An example you can refer to:

//Get the current active workbook name
string bn$ = %H; 
//loop over all worksheets in the current workbook
loop(ii,1,page.nlayers) 
{
  //Add dataset into a specified graph layer	
  plotxy [bn$]$(ii)!(1,2) plot:=200 ogl:=[Graph1]1!;
}

Hope it helps!

Yuki
OriginLab
cqy2016 Posted - 08/17/2016 : 04:13:24 AM
quote:
Originally posted by yuki_wu

Hi Jan,

I understand what you mean now, and you guess it right!!!

It is a bug caused by [BookName] being considered as a section.

We have added this problem to our bug tracking database, ID ORG-15148, and will improve it in the future.

Sorry for the inconvenience. Perhaps you can try these scripts below:

range col1=[book1]sheet1!1;
for(ii=1;ii<5;ii++)
{
	col1[ii]=1;
}


Thanks,
Yuki
OriginLab




Hi Yuki,

Do you know how to increment the sheet number and layer number?
for example, i have such code as following:
range rr = [Book1]1!$(ii);
page.active=$(ii); //active the worksheet;
plotxy iy:=%(rr)(3,28) plot:=200 ogl:=$(ii);

Here the sheet number is identical as layer number, and i want to plot 2 columns of data from each sheet and put them into one layer of a graph, and then go on with this process till all sheets have been plotted. Do you have a solution for my case?
yuki_wu Posted - 08/16/2016 : 10:57:40 PM
Hi Jan,

I understand what you mean now, and you guess it right!!!

It is a bug caused by [BookName] being considered as a section.

We have added this problem to our bug tracking database, ID ORG-15148, and will improve it in the future.

Sorry for the inconvenience. Perhaps you can try these scripts below:

range col1=[book1]sheet1!1;
for(ii=1;ii<5;ii++)
{
	col1[ii]=1;
}


Thanks,
Yuki
OriginLab
J.S.Schulte Posted - 08/16/2016 : 08:55:08 AM
Hello Yuki,

that is exactly the point: in the Script Window, your test script works fine.

If you put the lines in a script file (.ogs) which you can execute via buttons it does not work!

So, I guess we need another command!

Any suggestions?

Best, Jan
yuki_wu Posted - 08/15/2016 : 9:56:50 PM
Hi,

I don't think the lines will be misinterpreted as sections because of []. As a test, you can try to create a new and blank project, and then run the scripts below in Script Window

for(ii=1;ii<5;ii++)
{
	[book1]sheet1!Cell(ii,1)=1;
};


FYI, looping over object is documented here:
http://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs

Yuki
OriginLab

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