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 |
|
|