Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 8 SR4 Operating System: Windows XP
Hello everyone!
I am having a maybe very simple question: How do I access the output of a NLSF fit in Origin C? By output I do not mean the fit parameters but the actual data points which make up the fitted curve displayed in the graph.
In my case I use the user-defined fitting function "XSW_reflectivity" which fits a theoretical curve to data which is contained in Book_2, column B(Y) (the worksheet is named "ExpReflectivity" and column B is labelled "Exp. Reflectivity"; column A(X) holds the corresponding X values). Now when I run the Origin C routine which calls the above mentioned function the NLSF creates a new workbook named "XSW_reflectivity fit of Book2_B" with two columns that contain both X and Y data of the fit curve. All I want to do now is to copy these two columns to the very workbook that already holds the data which is fitted, i.e. Book_2 = "ExpReflectivity", since I need them for further computation. I just cannot find a solution to do that although I have the feeling it shouldn´t be too difficult...
Can you help me? I really accomplish your advises. Thank you very much in advance!!!
Thank you for your rapid answer. Unfortunately I do not see a clear connection between the wiki page which you posted and my problem: the link deals with NLfitsessions while I use NLSF which I call from Origin C via
using NLSF = LabTalk.NLSF;
I tried to get access to the dataset which is generated by the NLSF with the NLSF.xmode = 0, NLSF.funccol$ = str... and NLSF.makecurve("func") commands. This works well with those fit functions which come with ORIGIN. Yet in my case - with a user defined fitting function including a convolution - the simulated dataset looks similar but is different from the actual fit result; namely it is shifted in X and scaled differently in Y. Have you got an idea what could be the problem here?
Another question which arose is: What is the default worksheet / column where the dataset generated by the NLSF.fit(n) command is stored? According to the LabTalk help files it should be right next to the original input data:
"In the default case the curve is generated and the data is placed in the original worksheet next to the independent variable."
Yet in my case a new worksheet is created - like I already described in my above post. Why is this? How to I address that freshly created worksheet in ORIGIN C.
Sorry for bothering you again. I am looking forward to your answer.
Is there a reason that you must use the old fitting engin from earlier version?
using NLSF = LabTalk.NLSF;
This is using the old fitting via LabTalk and we are providing that for backward compatibility support only. Best if you can use the new Origin 8 fitter which is much more flexible and much faster. The NLFitSessionBase class Iris mentioned is the best way to use the new fitter.