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
 extracting sections from wks into several wks

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
linele Posted - 02/04/2009 : 10:04:00 AM
Hi everyone,

need a little help:
after having imported an ASCII-file into Origin, it looks like that (wks1):

col(a) col(b) col(c)
800.000000 0.150582 9.277585e-002
825.000000 0.263400 8.201367e-002
...
5000.000000 0.248629 6.084247e-009
800.000000 0.250582 7.277585e-002
...
5000.000000 0.348629 7.084247e-009

I am looking for a script, which extracts each section in wks1 starting from 800 (till 5000) and inserts it into a new worksheet. The goal is to get several worksheets containing just one section 800-5000.

Thanks for your help!

3   L A T E S T    R E P L I E S    (Newest First)
linele Posted - 02/06/2009 : 02:56:12 AM
Thank you guys!
greg Posted - 02/05/2009 : 12:19:36 PM
I do not think Vincent's code is what you want.
Here is a script that assumes your data groups are defined by increasing order:

// BEGIN SCRIPT
%M = %H;
wcols = wks.ncols;
get col(1) -e last;
val = 1e307;
loop(ii,1,last)
{
test = %M!cell(ii,1);
if( test < val && test != 0/0)
{
win -t data origin;
wo -a wcols - wks.ncols;
%N = %H;
row = 1;
}
loop(jj,1,wcols)
{
%N!cell(row,jj) = %M!cell(ii,jj);
}
row++;
val = test;
}
// END SCRIPT

The script has been optimized for version 7 and works in 8 as well.
VincentLiu Posted - 02/05/2009 : 02:28:19 AM
Hi Caroline,

You may try the X-Function "wxt" to get what you want. The following command is to show you how to extract the data to a new worksheet using "wxt".

wxt test:="col(a)>=800 & col(a)<=5000" ow:=<new>;

To use the command, you need to active your worksheet and then input the command in the Command Window. It will generate a worksheet called "extracted" which contains the extracted data. For more details about the function, please refer to

http://www.originlab.com/www/helponline/Origin8/en/mergedProjects/X-Function/X-Function/wxt.html

Please see whether it is can solve the problem. If not, please give us more details through

http://www.originlab.com/www/company/qform.aspx?s=1&

Best regards,
Vincent Liu
OriginLab Technical Services

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