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
 simpe script for data exctraction doesn't work
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ivanovskikh

New Zealand
14 Posts

Posted - 07/23/2012 :  8:35:09 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.6.0 Sr.2
Operating System: Win 7
Hi everyone,

I am trying to write a simple script which extracts results of NLFitting and puts values into a worksheet. Particularly it gets values of lifetime (Tau) obtained for fitted decay curves, Takes long name of column of original data that corresponds to temperature and then put lifetime in corresponding raw of [Results]Tau! worksheet. in [Results]Tau! the first column is filled with temperature values.

I just modified a similar script which I did long time ago in Origin 8.5.1, made it much easier (as I exctrac only one parameter) but it doesn't work at all!

%B=[Results]Tau!; //*****;
string strLastReport$ = __REPORT$; // get name of result sheet for the last NLfit procedure
getresults tr:=MyResults iw:=%(strLastReport$);

range Temp = %Bcol(temp); /
range Tau = %Bcol(tau);

range MyData = %(MyResults.Input.R2.C2$);
MyResults.Input.R2.C2$=;

MyData.col.lname$=;

loop (ii, 1, 24){
if (Temp[ii] == %(MyData.col.lname$)){
Tau[ii] = MyResults.Parameters.t1.Value;
type -b "The fiting results are put into \n%B row $(ii)\n Thanks!";
};
};


I found that problems appear with MyData.col.lname$. Why Origin doesn't like it? Any ideas? What is wrong?

Thanks!

Konstantin

ivanovskikh

New Zealand
14 Posts

Posted - 07/24/2012 :  12:45:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I just want to add

If type this

range rMyData = %(MyResults.Input.R2.C2$);
MyResults.Input.R2.C2$;
rMyData.col.lname$=;

The second command returns "[DecayCurves]Sheet1!50" - correct name of column with data taken for fitting.
The last command doesn't work at all. It is very strange!

Edited by - ivanovskikh on 07/24/2012 12:46:00 AM
Go to Top of Page

Kathy_Wang

China
159 Posts

Posted - 07/24/2012 :  01:12:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The problem occurred because the long name of your column is a number, so if you define a range as

[DecayCurves]Sheet1!50;


50 is considered as the column index (i.e. the 50th column) rather than the column with long name 50.

A possible solution would be to extract the string after "!" and use this as the long name, the example script would be:


string str1$=MyResults.Input.R2.C2$;
%M=str1$;
%N=%[%M,>'!'];


and %N is the string register which stores the long name of the column.

Please note that if your column long names are texts, your script shall work fine.

Kathy
Originlab

Edited by - Kathy_Wang on 07/24/2012 01:20:47 AM
Go to Top of Page

Kathy_Wang

China
159 Posts

Posted - 07/24/2012 :  01:45:42 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
In addition, your problem with numeric long names will be fixed in our next version 9.0.

And if you used nonlinear curve fit to generate your results, you are recommended to use the "getnlr" x function instead of "getresults". Because "getnlr" is specified to get results from nonlinear fit, but "getresults" is generally used for all report sheet. So a sample code to get the long name of your input column would be:


string strLastReport$ = __REPORT$;
getnlr tr:=MyResults iw:=%(strLastReport$);
mylname$=myresults.data1.name$;


Here the string "mylname$" is the column long name of your input data column, this will work no matter the column long name is numeric or text.

Kathy
Originlab

Edited by - Kathy_Wang on 07/24/2012 01:46:40 AM
Go to Top of Page

ivanovskikh

New Zealand
14 Posts

Posted - 07/25/2012 :  12:23:39 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by Kathy_Wang

In addition, your problem with numeric long names will be fixed in our next version 9.0.

And if you used nonlinear curve fit to generate your results, you are recommended to use the "getnlr" x function instead of "getresults". Because "getnlr" is specified to get results from nonlinear fit, but "getresults" is generally used for all report sheet. So a sample code to get the long name of your input column would be:


string strLastReport$ = __REPORT$;
getnlr tr:=MyResults iw:=%(strLastReport$);
mylname$=myresults.data1.name$;


Here the string "mylname$" is the column long name of your input data column, this will work no matter the column long name is numeric or text.

Kathy
Originlab



Hi Kathy,

Many thanks, it works now! getnlr function is really easier to use.
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