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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 simpe script for data exctraction doesn't work

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ivanovskikh Posted - 07/23/2012 : 8:35:09 PM
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
4   L A T E S T    R E P L I E S    (Newest First)
ivanovskikh Posted - 07/25/2012 : 12:23:39 AM
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.
Kathy_Wang Posted - 07/24/2012 : 01:45:42 AM
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
Kathy_Wang Posted - 07/24/2012 : 01:12:37 AM
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
ivanovskikh Posted - 07/24/2012 : 12:45:28 AM
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!

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000