The Origin Forum
File Exchange
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Automation Server/COM and LabVIEW
 Excel VBA ,Curve Fitting and Fitting Parameters

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
   

T O P I C    R E V I E W
hflemming Posted - 02/03/2010 : 12:12:58 PM
Origin 8.0.63.988 and Service Release R6:
Operating System: Windows SP3 64XP
Hello
Employing Samples\Automation Server\Excel\ Single Peak Fit, I have successfully opened Origin with Excel VBA, opened an ogw file, imported data, and recovered the fit parameters from a "summary" worksheet(wks) with linked cells.

I have discovered my Excel application needs to supply the Origin fitting process with a Row range and the Intercept value.

I do not know how to access the "Tree" parameters in a fitting function with Excel VBA the way LabTalk's NLBegin. The TreeNode and TreeNodes Classes are thinly described in the COM help.

I am using the ogw's as analysis templates but need to access the fitting parameters of the ogw before inputting data for crunching.

Any Excel VBA examples available that demonstrate access to the fitting function parameters in an ogw?

Thank you
Howard

10   L A T E S T    R E P L I E S    (Newest First)
samairakh Posted - 07/19/2019 : 05:01:18 AM
Here is a model dependent on hflemming's post:

/Get the task tree

op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=get;

/Change the info range to lines 8 to 18

MyTr.GUI.InputData.Range1.X$ = [LinFitRGB]Data!A[8:18];

MyTr.GUI.InputData.Range1.Y$ = [LinFitRGB]Data!B[8:18];

/Make the Block fixed

MyTr.GUI.Fit.FixIntercept = 1.;

/Fix the Capture to 0.5

MyTr.GUI.Fit.FixInterceptAt = 0.5;

/Now set the tree and keep running with the new qualities

op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=run;

To see the entire tree, execute

https://ahmedabad.crbtech.in/electrical-design-training-programme/
VladGets1 Posted - 11/01/2016 : 07:54:15 AM
I was looking for this script for a long time. Thank you.
quote:
Originally posted by greg

Beginning with Origin 8.1 SR2 there is an X-Function for accessing operations : op_change. With it, you can get, set or set & run the operation tree values.

Here is an example based on hflemming's post:

// Get the operation tree
op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=get;
// Change the input range to rows 8 to 18
MyTr.GUI.InputData.Range1.X$ = [LinFitRGB]Data!A[8:18];
MyTr.GUI.InputData.Range1.Y$ = [LinFitRGB]Data!B[8:18];
// Make the Intercept fixed
MyTr.GUI.Fit.FixIntercept = 1.;
// Fix the Intercept to 0.5
MyTr.GUI.Fit.FixInterceptAt = 0.5;
// Now set the tree and run with the new values
op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=run;

To see the whole tree, execute
MyTr.=


greg Posted - 03/20/2012 : 09:42:35 AM
Beginning with Origin 8.1 SR2 there is an X-Function for accessing operations : op_change. With it, you can get, set or set & run the operation tree values.

Here is an example based on hflemming's post:

// Get the operation tree
op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=get;
// Change the input range to rows 8 to 18
MyTr.GUI.InputData.Range1.X$ = [LinFitRGB]Data!A[8:18];
MyTr.GUI.InputData.Range1.Y$ = [LinFitRGB]Data!B[8:18];
// Make the Intercept fixed
MyTr.GUI.Fit.FixIntercept = 1.;
// Fix the Intercept to 0.5
MyTr.GUI.Fit.FixInterceptAt = 0.5;
// Now set the tree and run with the new values
op_change ir:=[LinFitRGB]"R FitLinear1" tr:=MyTr op:=run;

To see the whole tree, execute
MyTr.=
freedom7 Posted - 08/09/2011 : 11:18:14 AM
I see this is an old topic but I found it very useful. Thanks for the illustrations.
dannyworthz Posted - 07/03/2011 : 09:39:49 AM
Thanks for this illustration. I learned for it.
TNavarro Posted - 05/18/2011 : 12:01:43 PM
Hello guys,
This is a good topic, I hoping to hear and discover new script.
Thanks in advance.
arsk Posted - 01/23/2011 : 10:58:49 PM
Hey, I would like to see some of the scripts. I hope you might have done all those. I am looking forward to getting them also. Anyway thanks a lot for posting such wonderful details in such a simple and demonstrative manner. I will come here back again to check the updates.

Hello
cpyang Posted - 02/05/2010 : 1:24:44 PM
Thanks for providing the details, and also about PDF suggestion which we can investigate separately.

So it looks to me that you want to have control on the settings saved in the ogw. This will be best done via LT script which you can test separately from Origin and once the script works as expected, then send the script over from Excel.

We will then just give you some script examples on how to control these parameters. We will work on this in the next couple of days.

CP
hflemming Posted - 02/05/2010 : 12:58:48 PM
Thank you for your interest



I wish the forum could support a pdf upload. Regardless screen shots in the above jpgs show how I hope to use the ogw.

I need to access the "green lock" in the upper corner of the Report wks to get to the fitting dialog parameters.
I need to do this from Excel VBA.

Thank you
cpyang Posted - 02/05/2010 : 10:36:45 AM
We can creat a more complete example to illustrate the process of fitting using Origin from Excel, but maybe you can describe your "user story" so we can understand your need better.

If you are using Analysis Template, all your fitting results can be put into a summary sheet with links to the report table, so you can just access those cells in the summary sheet and there is no need to access the tree directly.

But if you are not using Analysis Template but using LT nlbegin etc, then the story will be very different, and then the access to the LT tree will be needed, but might be more involved from the VBA side to read an XML tree.


CP

The Origin Forum © 2008 Originlab Corporation Go To Top Of Page
Snitz Forums 2000