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
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Using GUI.InputData to set X-Errors/Y-Errors
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ScriptQuestions

Germany
4 Posts

Posted - 03/03/2022 :  12:34:33 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Version: OriginPro 2020b (Academic);

Hello,

I am trying to automate non-linear fitting with Orthogonal Distance Regression, as my data has both X and Y errors. My current code is taken from another forum post here, and was the first solution to allow me to change the fitting algorithm by script. This is my current code:

tree nlGUI;
xop execute:=init classname:=FitNL iotrgui:=nlGUI;

//Specify function and input data, then update operation tree before fitting.

nlGUI.GUI.FunctionSelection.FunctionList$="Allometric1";


nlGUI.GUI.FunctionSelection.fitmethod=2; //Use ODR




nlGUI.GUI.InputData.Range1.X$=Col(A);



nlGUI.GUI.InputData.Range1.Y$=Col(C);




xop execute:=update iotrgui:=nlGUI;

xop execute:=report iotrgui:=nlGUI;

//Clean up operation objects after fit

xop execute:=cleanup;


My error data is in Col(B) for the X error, and in Col(D) for the Y error. What is the right syntax to enter this data into my InputData?
Or, in other words, where in the tree do I put the Error data?




This is how the GUI would look like if the data input was made by hand. The range1.X$ value has a sub-branch, which i would like to access via script to fill in my error values, but I do not know the correct syntax. Any help would be much appreciated.

Edited by - ScriptQuestions on 03/04/2022 04:35:41 AM

minimax

357 Posts

Posted - 03/04/2022 :  04:50:20 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi ScriptQuestions,

Note: 2020b does not support the script below very well yet.
You may try upgrading to latest version to take a try?

Please try using XF nlbegino:
https://www.originlab.com/doc/en/X-Function/ref/nlbegino

//Start the implicit fit with instrumental error, column 4 is the y error and column 2 is the x error.
nlbegino iy:=(1,3,4,2) func:=Allometric1 weight:=1;
nlfit;
nlend 1 1;
Go to Top of Page

ScriptQuestions

Germany
4 Posts

Posted - 03/04/2022 :  08:50:10 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you for this solution, after updating to 2022 it works like a charm, as it did not work for 2020b.

Thank you very much!
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000