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
 Define a function in nlsf
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Malab

Germany
19 Posts

Posted - 05/15/2002 :  04:03:36 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello
can define a function (dep Var, indep Var, Parameters) for nlsf with a script? Because if I give my Origin file away, the user functions for nlsf are not saved in the opj file and so a simple nlsf script can not run f.E. on an other PC!
There is only the command nlsf.func$="Gau"; but I need something like nlsf....="y=ax^2+bx+c" and so on.

Lorraine

USA
66 Posts

Posted - 05/16/2002 :  10:51:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can send the user defined fdf file along with your Origin project. If you create your own function in Origin and you want to send it to someone else you can send the OPJ file and the .FDF file found in your fitfunc folder. It is called user#.fdf. This also can be called in Script, i.e., nlsf.func$="myfunc";

Function Name=myfunc
Brief Description=user1

(the filename is user1.fdf and that's the actual file you would send).

Then all your colleague needs to do is open the OPJ file in Origin, then open the NLSF tool and choose Function:Select.. then Function:Add... and add your user#.fdf file. The function then can be used in script or from the interface.

Lorraine
OriginLab Technical Support
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/16/2002 :  2:22:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Origin 7 supports adding fiting functions (FDF files) by drag-and-drop. So your colleague can just drag-and-drop the FDF file that you send them and the function will become available from the NLSF interface and from the Fitting Wizard interface.

Easwar
OriginLab.

Edited by - easwar on 05/16/2002 14:23:03
Go to Top of Page

Malab

Germany
19 Posts

Posted - 05/17/2002 :  09:47:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
But if my colleague have allready a file with the name f.E. user1.fdf he have to overwrite his file. To rename my file is not possible, because then it doesn't appear in the nlsf dialog.

In Origin 7, is it possible to declare a nlsf function by script?
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/18/2002 :  1:09:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi JohnCF,

The function does not show up in the dialog after renaming because the ini file still has the old name and has to be updated.

Here is the procedure to avoid the problem - bear with me if there is more detail in here than necessary!

Suppose that when you define a new function in NLSF (Function|New menu item), Origin suggests the default name of user1. Let us say you change that to MyFunc. After you define your function and click the Save button, Origin writes the definition to a file called user1.fdf, which will be located in the \Fitfunc subfolder.

To rename the function properly, do the following:
1> Go to the \Fitfunc folder and rename user1.fdf to MyFunc.fdf
2> Go to the Origin root folder and open the file nlsf.ini in Notepad or some other text editor
3> In the .ini file, replace all instances of the string "user1" with the string "MyFunc". You will find the string "user1" under the section of the category (such as [Origin Basic Functions]) in which you defined the function. You may also find another instance of the string "user1" if you have already fit with that function, whence Origin sets user1 as your default function for that category.
4> Save the ini file, go back to NLSF and do Action|Initialize from the menu (Action | Reset Fitter if you are using ver 7). Now, for your purpose, MyFunc will be available for fitting.

You can now send the file MyFunc.fdf to your colleague. The good news is that your colleague does not have to go thru all the above steps. They can just add the function to their installation using the Function|Add menu item in NLSF (or drag-and-drop to Origin interface in ver 7). The function will be available for them to use right after they added it, in whatever category they add it to.

The above of course assumes that your colleague does not already have a function named MyFunc. If you name your functions uniquely, chances are they do not.

Hope this helps you resolve your current problem. Thank you for bringing this to our notice. We will work on fixing this problem in general so that in a future version you will not have to go thru all the steps I outlined here.

Have you tried Origin 7 yet? A free demo is available on our website. In Orign 7, there is C compiler support, which makes fitting with user-defined function much faster than in previous versions. Also, the C language allows one to define more complex user-defined functions easily.

Easwar
OriginLab.
Go to Top of Page

Malab

Germany
19 Posts

Posted - 05/21/2002 :  04:36:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, that helps a lot!
Could this problem be solved in a new SR Pack for Version 7?
Go to Top of Page

easwar

USA
1965 Posts

Posted - 05/21/2002 :  09:02:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Yes, we will try to resolve this in a Service Release for ver 7.

Easwar
OriginLab.
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