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
 NLSF Constraints
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jc001

UK
7 Posts

Posted - 03/20/2002 :  11:57:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm writing an iterative fitting tool, and
need to update other parts of the project as the user edits any constraints in the NLSF object.

Is there anyway to read the constraints
string out from the NLSF object?
Nlsf.constr$ only works one way.

I wrote a script to read the constraints string from the .fdf file, but this file doesn't get updated as the constraints are edited in the dialog box.

Could there be some script way to force the fitter to save the fitting function file without requiring the user to hit save?

Thanks

rtoomey

USA
184 Posts

Posted - 03/22/2002 :  10:33:51 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You should be able to read the General Linear Constraints into a string variable as follows:

%A=nlsf.constr$;

Since you wrote a script to read the constraints, why not then reverse the process and write to the FDF file after setting the constraints. That way you effectively update both the interface and FDF at the same time.

New ini object methods in Origin 7 should allow you to do this very easily. For instance, the ini.setstr() method now accepts the following arguments:

ini.setstr(keyValue,keyName,sectionName,fileName);

Translate this into setting the constraints and you get something like:

ini.setstr(b2;a2!=b2;,a1!,Constraints,%Yfitfunc\user1.fdf);



Of course, the constraints I have entered aren't really valid. They are just for illustrative purposes.

- rtoomey




Note: In earlier versions of Origin you would need to execute something like:

ini.get.fileName$=%Yfitfunc\user1.fdf;

ini.section$=Constraints;

ini.setstr(b2;a2!=b2;,a1!);





Go to Top of Page

jc001

UK
7 Posts

Posted - 03/24/2002 :  11:52:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks

But I still have no joy returning the constraints string from nlsf.Constr$. I wondered if this might be because I'm setting multiple constraints separated with semi-colons or because I'm using a string variable to set them, but even using no semi-colons with only one literal constraints string:

nlsf.constr$="A1>=0.00234";
%A=nlsf.constr$;
%A=;

returns an empty string.

I'm using NT4, could this be the problem?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 03/24/2002 :  5:53:02 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I copied the script from your last message and pasted it into both the Origin 6.1 and 7.0 script window. It returned

A1>=0.00234

in both cases. I'm running Win2k, but I doubt if that matters.

Mike Buess
Origin WebRing Member
Go to Top of Page

jc001

UK
7 Posts

Posted - 03/25/2002 :  10:48:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
That is strange?...

I have hit upon a work around though using a macro that calls the nlsf.cMatrix property to access the constraint data and then rebuilds the original constraint string from this!
Go to Top of Page

rtoomey

USA
184 Posts

Posted - 03/25/2002 :  11:46:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I should note that you should clear any previous constraints before setting new ones (even if the constraints were empty before).

For instance:

nlsf.constr$="";
nlsf.constr$="A1>=0.00234";
%A=nlsf.constr$;
%A=;

Does that help?

- rtoomey

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