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
 How access to field of "Extarct Worksheet Data"

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
jeff46 Posted - 05/24/2004 : 09:08:51 AM
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.
3   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 05/26/2004 : 10:44:04 AM
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
jeff46 Posted - 05/26/2004 : 08:45:02 AM
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 ?
Mike Buess Posted - 05/24/2004 : 3:43:25 PM
The "Put in worksheet" name in that dialog is generated internally and can't be changed by script.

Mike Buess
Origin WebRing Member

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