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
 extracting sections from wks into several wks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

linele

Germany
5 Posts

Posted - 02/04/2009 :  10:04:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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!

VincentLiu

China
Posts

Posted - 02/05/2009 :  02:28:19 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

greg

USA
1379 Posts

Posted - 02/05/2009 :  12:19:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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.
Go to Top of Page

linele

Germany
5 Posts

Posted - 02/06/2009 :  02:56:12 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you guys!
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