Author |
Topic |
|
zangyef
Italy
Posts |
Posted - 03/06/2006 : 11:06:12 AM
|
Origin Version (6): Operating System: Win XP
Hi everyone, I'm writing some scripts associated to a user defined buttons in order to save time in a series of repetitive action. One of this consist of a nlsf procedure. The script I wrote is the following:
nlsf.Begin(); nlsf.Init(); nlsf.PasteToPlot=1; \\do not work! nlsf.PasteToPlot=0; \\do not work! nlsf.Func$="Log3P1"; nlsf.fitData$="originaldata_D"; nlsf.p1=40; nlsf.p2=-4; nlsf.p3=300; nlsf.v1=1; nlsf.v2=1; nlsf.v3=1; nlsf.Iterate(100); nlsf.funcx$="originaldata_A"; nlsf.funcCol$="originaldata_I"; nlsf.xBegin=1; nlsf.xEnd=originaldata!wks.nRows; nlsf.xPoints = (nlsf.xEnd)-(nlsf.xBegin); nlsf.xMode=0; nlsf.makecurve(func); nlsf.End(); nlsf.unInit(); originaldata!wks.addcol(I); originaldata!wks.col9.label$="baseline"; copy NLSF1_B originaldata_I; window -c NLSF1;
The script works well if pastetoplot and pastetoscript doesn't appear but if i add that instruction some the script doesn't work or work improperly (the error "NLSF.PASTETOSCRIPT is an illegal name for defining a variable. It must not start with a number, nor an operator and may not contain a dot." appear, showing that origin interpret it as a user defined variable). Why? Any suggestion is appreciated. Thank you |
|
Mike Buess
USA
3037 Posts |
Posted - 03/06/2006 : 11:39:23 AM
|
There is no nlsf.pastetoscript property, hence the error. You might try nlsf.pastetolog which presumably sends results to the Results log. nlsf.pastetoplot should not give you a problem because it is a valid property which is set to 1 by default.
...Now I see where you got pastetoscript. It was an NLSF property in Origin 5.0 (which does not have a Results log) but was replaced by pastetolog in Origin 6.0 (which does have Results log).
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 03/06/2006 5:26:57 PM |
|
|
zangyef
Italy
Posts |
Posted - 03/07/2006 : 03:22:20 AM
|
Thank you very much Mike. It's an error in the LabTalk Help file. Now the script works well with the property PasteToLog (I set it to 0), but with PasteToPlot nothing happens: I set it to 1 but the log was not paste to graph. Why?? |
|
|
Mike Buess
USA
3037 Posts |
Posted - 03/07/2006 : 09:05:32 AM
|
Try nlsf.PasteToPlot=2.
Mike Buess Origin WebRing Member |
|
|
zangyef
Italy
Posts |
Posted - 03/07/2006 : 10:32:05 AM
|
Thanks a lot, Myke. Now all works well! But, if I may ask.., why 2 instead of 1? What is the action of 1? Thanks again! |
|
|
Mike Buess
USA
3037 Posts |
Posted - 03/07/2006 : 11:20:51 AM
|
I was afraid you were going to ask that. Somehow NLSF changes the value to 1 after you set it. And if you set to 1 NLSF changes it to 0 which explains why your original script did not work. Try this...
nlsf.PasteToPlot=2; nlsf.PasteToPlot=; // ask for its value NLSF.PASTETOPLOT=1
nlsf.PasteToPlot=1; nlsf.PasteToPlot=; NLSF.PASTETOPLOT=0
nlsf.PasteToPlot=0; nlsf.PasteToPlot=; NLSF.PASTETOPLOT=0
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 03/07/2006 11:27:50 AM |
|
|
zangyef
Italy
Posts |
Posted - 03/08/2006 : 02:59:31 AM
|
Thanks Myke, strange beasts these softwares (as we say in Italy!) |
|
|
aeolian1
Germany
Posts |
Posted - 10/30/2013 : 2:03:40 PM
|
Hello,
I am using the nlsf functions in LabTalk (9.0.0, SR2) since I cannot get the nlbegin/nlfit/nlend functions to work (the X-functions either insist on fitting columns different from those which I specify in a range or give crazy results). My code is now complete and the fitting works just fine. It is done in a loop; one plot is generated for each pass (~50 in all). One small detail is missing, however: I can't get the fitted parameters to paste to the plots. Within the loop, I have tried
1. nlsf.pasteToPlot = 1; 2. nlsf.pasteToPlot = 2; 3. NLSF.PasteParams("P");
but none of these work. Could you please provide another tip? Thank you.
P.S. The "meat" within the for loop looks like
nlsf.begin(); nlsf.init(); nlsf.cleanUpFitData(); ... nlsf.iterate(100); nlsf.makecurve(func); ** HERE I TRY TO PASTE THE PARAMS TO THE PLOT ** nlsf.unInit(); nlsf.end(); |
|
|
|
Topic |
|