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
 How access to field of "Extarct Worksheet Data"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

jeff46

France
Posts

Posted - 05/24/2004 :  09:08:51 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I program a buton in Labtalk for apply "Analysis"->"Extract Worksheet Data"
the worsheet script is:
menu -e 36496;

but I can't put a name in "Put in worksheet" by programing.

Mike Buess

USA
3037 Posts

Posted - 05/24/2004 :  3:43:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The "Put in worksheet" name in that dialog is generated internally and can't be changed by script.

Mike Buess
Origin WebRing Member
Go to Top of Page

jeff46

France
Posts

Posted - 05/26/2004 :  08:45:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike,
So "Put in worksheet" is generated internally but I had to use it several times and the "If" field have to be changed but when I call "Put in worksheet" again "If" preserves the last.
Can I change it by script before posting ?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 05/26/2004 :  10:44:04 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
As you probably found out when you learned its menu ID there are no scripts associated with this command. It is built in to the Origin program and there is no method that I know about to determine how the 'if' condition is stored.

If you already know the 'if' condition and have a name in mind for the output wks you can probably accomplish the operation with your own script. For example, say you want to extract from the active wks all rows for which col(B)[i]>0.5 and want the output to go to Data23 (which does not already exist).

win -d; // duplicate active wks
doc -e W {%W=%H}; // Find the name of the last wks created (your duplicate)
win -r %W Data23; // rename it Data23
win -a Data23; // activate Data23
// The rest is the LabTalk equivalent to a while loop
for(i=1;i>0;) {
if(col(B)[i]==0/0) break; // abort when you find missing value (no data)
if(col(B)[i]>0.5) i++; // increment row index if condition is met
else {
mark -d col(B) -b i -e i; // delete row i if condition not met
};
};

There are might be more efficient ways to do it but it's a place to start.

...Here's a better way to deal with thresholds. It assumes the X values are in col A in ascending order.

%O="output wks name";
threshold=0.5;
win -d;
doc -e W {%W=%H};
win -r %W %O;
win -a %O;
sort -wd %H col(B); // sort wks in descending order of col B
col(B)=(col(B)>threshold)?col(B):0/0; // replace all values below threshold in col B with missing values
// Use the tReplace function in Origin 6.1 or later (more efficient than ternary operator)
sum(col(B));
set %H -er sum.n; // set # rows to # of actual (non-missing) values
sort -w %H col(A); // resort in ascending order of col A

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 05/26/2004 10:49:32 AM

Edited by - Mike Buess on 05/26/2004 12:33:19 PM
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