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
 Multiple X datasets in nlbegin
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sperling

14 Posts

Posted - 06/29/2009 :  09:49:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm using Origin 8 SR 5 with XP, and I'm essentially trying to write a LabTalk script that can automate what's described in the tutorial "Fitting One Dataset as a Function of Other Datasets":

http://www.originlab.com/www/helponline/Origin8/en/mergedProjects/Tutorial/Tutorial/Fitting_Datasets.html

So what I think I need is...

range aa=(2,3,4);
nlbegin aa MultiIndep tt;

However, I keep getting an error "Please select at least one XYRange."

Is there any way to define multiple X datasets in nlbegin?

cpyang

USA
1406 Posts

Posted - 06/29/2009 :  2:48:00 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Assuming that you are using col(1) as X for all those, then

range aa=(1,2:4);

should be used to defined multiple XY. Alternatively, you can write

range aa=((1,2),(1,3),(1,4))


CP
Go to Top of Page

sperling

14 Posts

Posted - 06/29/2009 :  3:05:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the reply, but because I have two X's and one Y, your solution doesn't really work.

The equation in the tutorial is...

ab = C1*a + C2*b

I want Col(2) to be my "a", Col(3) to be my "b", and Col(4) to be my "ab". I can do this manually (like the tutorial), but I have not been able to write a LabTalk script.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 06/29/2009 :  4:51:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
sorry, i didnt look up that wiki first. There maybe a bug, we will need to investigate and let you know.

CP
Go to Top of Page

minimax

354 Posts

Posted - 06/29/2009 :  10:48:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sperling,

There is a tricky workaround in SR5.

Before running your script, highlight all your 3 columns and then run your script. (assuming your columns are set with proper designations: X X Y. If not, you should set them manually or use script like worksheet -t 2 4; to set.)

You can also use some LT script like worksheet -s 2 0 4 0; to select columns.

We will try to fix it so that without selection will work too.

Max
OriginLab Technical Support
Go to Top of Page

sperling

14 Posts

Posted - 06/30/2009 :  10:02:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks, Max! Your trick works...mostly.


worksheet -t 2 4; //Change column 2 to X
worksheet -t 3 4; //Change column 3 to X
worksheet -s 2 0 4 0; //Select columns 2 to 4
range aa = (2,3,4);
nlbegin aa MultiIndep tt;
tt.C1=1; //Initialization of parameter C1
tt.C2=1; //Initialization of parameter C2
nlfit;
worksheet -t 2 1; //Change column 2 back to Y
worksheet -t 3 1; //Change column 3 back to Y


The problem now with the worksheet -s 2 0 4 0 line. The columns must be in the order a(X) b(X) ab(Y). Can you think of any other way to make this a bit more flexible in terms of column position/order?
Go to Top of Page

minimax

354 Posts

Posted - 07/01/2009 :  10:49:57 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Sperling,

The clumns order can be a(X) ab(Y) b(X).

Then you should define your range accordingly, such as
range aa= (2, 4, 3);

That is to say, the order in the range definition must be XXY.

Max
OriginLab Technical Support
Go to Top of Page

sperling

14 Posts

Posted - 07/01/2009 :  11:07:52 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by minimax

The columns order can be a(X) ab(Y) b(X).



Thanks! That should have been obvious. Maybe I need a vacation.
Go to Top of Page

sperling

14 Posts

Posted - 09/02/2009 :  4:42:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I foolishly updated to SR6, and the workaround no longer works.

In Code Builder, the nlbegin line gives me

Some subrange fail to set data.
No valid data is set.

Script windows gives me the "Please select at least one XYRange" message I was getting before.

Anyone know of another workaround?

Edited by - sperling on 09/14/2009 11:31:29 AM
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