Author |
Topic |
|
JulesOZ
18 Posts |
Posted - 03/25/2013 : 9:29:23 PM
|
Origin Ver. and Service Release (Select Help-->About Origin): Pro 8.6 Operating System: Win7
I just updated Origin from 8.0 to 8.6 and tried running a program through the command window, which was working fine in the 8.0 version. I used the same data file that I used under 8.0 as well. I copy the script into the command window and hit enter and nothing happens. No output, no errors, no data generated. Does anyone have an idea what I have missed?
Here is the code: //This programm loops through all workbooks and worksheets of the active folder and performs a two-peak Gauss fit on the data.
doc -ef W {
int numWKB = page.nLayers; int k=1; int j; string Bname$ = page.name$;
j=Bname.Find("parameter"); //check if the active workbook is one of the newly generated parameter books if(j!=0) {}
else { type %(Bname$) has $(numWKB) Worksheets;
//type "Window: %H, layer number: $(page.active)"; string colA$; string colB$; string colFit$;
for(k=1; k<=numWKB; k++) // loop through the worksheets of one workbook { work -v Fit; // check if worksheet has a column named "Fit", if not it will be created
type "count $(k)"; if(k < 2) { colA$ = Bname$+"_A"; colB$ = Bname$+"_B"; colFit$ = Bname$+"_Fit"; }
else { string sIndex$ = $(k); colA$ = Bname$+"_A@"+sIndex$; colB$ = Bname$+"_B@"+sIndex$; colFit$ = Bname$+"_Fit@"+sIndex$; }
nlsf.func$ = gauss; nlsf.numReplica = 1; nlsf.cleanupfitdata(); nlsf.fitdata$ = colB$; //defines column used as y values y0=500; // The following lines define the starting values of the Gauss fits xc1=42; // They have to be set manually before fitting w1=0.6; A1=3000; xc2=49; w2=0.5; A2=3100;
nlsf.iterate(500); // Number of Iterations nlsf.xmode = 2;
nlsf.funcx$ = colA$; // defines column used as x-values nlsf.funccol$ = colFit$; //dataset to store fitted Y values nlsf.makecurve(func); //dataset generated for the fitted curve nlsf.pasteParams(R); nlsf.paramWks(parameter); } } }
|
|
matthew@originlab.com
73 Posts |
Posted - 03/26/2013 : 11:29:06 AM
|
Hi,
It looks ok, we were able to run your script ok on 8.6. Do you have other scripts you used on 8.0, if so are you able to run them ok on 8.6? Or do they not work either?
Matthew OriginLab |
|
|
JulesOZ
18 Posts |
Posted - 03/26/2013 : 8:20:44 PM
|
Yes, I tried little snippets of code like this one: range r1=[paraBF20BT1]Sheet1!col(value); // defines the column containing the desired value as range 1 range r2=[peakposition]Sheet1!col(pos111); // defines the column where the value should be stored as range 2 r2[1]=r1[2];
which worked in Origin8.0 but not in 8.6
I think it might be more some issues with settings or something, because the code is copied from the right-hand side window of the command window to the left hand side window, when I hit Enter, but nothing else is happening. Just in case it matters, here is the exact name of the version I use: Origin 8.6.0 (32bit) b70(Academic) |
|
|
cdrozdowski111
USA
247 Posts |
|
JulesOZ
18 Posts |
Posted - 03/26/2013 : 9:35:24 PM
|
I changed the variable thing, but that did not have an effect. But I noticed one strange thing: I have a comment header above the actual code. A few lines behind // If I copy these lines into the Command window, the code is not executed as I described it. When I just copy the code, it is executing! (Yea!) However, it is not running a perfect as it did under 8.0, e.g it seems to have problems to loop through the various worksheets. But I come back about that, if I can't figure it out.
But: is it possible that a comment header, that should be just ignored while executing, gives such problems???? |
|
|
easwar
USA
1964 Posts |
Posted - 03/26/2013 : 9:36:40 PM
|
quote: Originally posted by JulesOZ ...code is copied from the right-hand side window of the command window to the left hand side window, when I hit Enter, but nothing else is happening.
Hi,
So the history in the left panel of the command window updates, but the command does not execute as expected...
Open the classic script window (menu: Window->Script Window) and then paste the same script lines there, drag and select the lines with mouse, and then press Enter to execute. Does that work? If yes, somehow your command window is misbehaving, we need to try reproduce.
Also for long scripts such as the one you posted earlier, it is better to keep such script in a script file (OGS) and then execute from the file, see the LabTalk guide on how to create and use OGS files and sections.
Easwar OriginLab |
|
|
JulesOZ
18 Posts |
Posted - 03/26/2013 : 9:41:49 PM
|
Hi Easwar, using the script window as you suggested, works beautifully! So it's my command window having a bug?
And: the looping though the worksheets works as well again - I just forgot to un-comment a few lines. |
|
|
Penn
China
644 Posts |
Posted - 03/26/2013 : 10:48:02 PM
|
Hi,
It seems a bug in Origin 8.6 SR0 (b70), please upgrade to SR3 from this page. Or you can run the script in Script Window (open by menu Window: Script Window).
Penn |
|
|
JulesOZ
18 Posts |
Posted - 03/26/2013 : 11:13:30 PM
|
thanks! We are using a multi-user license, so I'll have to ask our administrator to do this.
|
|
|
JulesOZ
18 Posts |
Posted - 03/27/2013 : 02:36:42 AM
|
I updated to Origin9 and it seems to work now. Thanks a lot for your help!
|
|
|
|
Topic |
|
|
|