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
 Forum for Automation Server/COM and LabVIEW
 Excel VBA ,Curve Fitting and Fitting Parameters
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hflemming

USA
4 Posts

Posted - 02/03/2010 :  12:12:58 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

cpyang

USA
1406 Posts

Posted - 02/05/2010 :  10:36:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

hflemming

USA
4 Posts

Posted - 02/05/2010 :  12:58:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 02/05/2010 :  1:24:44 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

arsk

USA
5 Posts

Posted - 01/23/2011 :  10:58:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

TNavarro

1 Posts

Posted - 05/18/2011 :  12:01:43 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello guys,
This is a good topic, I hoping to hear and discover new script.
Thanks in advance.
Go to Top of Page

dannyworthz

USA
1 Posts

Posted - 07/03/2011 :  09:39:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for this illustration. I learned for it.
Go to Top of Page

freedom7

1 Posts

Posted - 08/09/2011 :  11:18:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I see this is an old topic but I found it very useful. Thanks for the illustrations.
Go to Top of Page

greg

USA
1378 Posts

Posted - 03/20/2012 :  09:42:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.=
Go to Top of Page

VladGets1

Germany
12 Posts

Posted - 11/01/2016 :  07:54:15 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.=


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