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
 Help with script: extract 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

Naughtje

USA
3 Posts

Posted - 09/21/2015 :  7:56:47 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Is there a way to extract multiple sweeps (or groups) of data contained in a single column and output them to a new workbook with each sweep (group) in a separate column? I know how to do this manually using the worksheet extract data query and then just copy and pasting each time to a new column in the new workbook, but I figured there is a way to write a script with a loop to avoid having to manually input the range for each extraction. Any help is greatly appreciated

SeanMao

China
288 Posts

Posted - 09/21/2015 :  9:43:28 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

To split columns into multiple columns by row index grouping, you can use X function colsplit. For details, you can search colsplit in X-Function documentation.

For example: colsplit irng:=col(A) method:=seq nrows:=10; // Extract every consecutive 10 rows into new columns.

If you want to split columns into multiple sheets, you can use wsplit function:

http://www.originlab.com/doc/X-Function/ref/wsplit

If you have a grouping column, you can unstack your data according to grouping information using wunstackcol:

http://www.originlab.com/doc/X-Function/ref/wunstackcol

Regards!

Sean

OriginLab Tech. Service
Go to Top of Page

Naughtje

USA
3 Posts

Posted - 09/22/2015 :  4:05:22 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Great thank you!
I'm now having trouble running this with multiple columns. I have the following script:
wunstackcol irng1:=col(D) irng2:=col(A) ow:=Sheet!1;
wunstackcol irng1:=col(E) irng2:=col(A) ow:=Sheet!2;
wunstackcol irng1:=col(F) irng2:=col(A) ow:=Sheet!3;
wunstackcol irng1:=col(G) irng2:=col(A) ow:=Sheet!4;
wunstackcol irng1:=col(H) irng2:=col(A) ow:=Sheet!5;

where I'm trying to output each iteration to a different worksheet, however, I end up only outputting the last iteration listed.
Go to Top of Page

Naughtje

USA
3 Posts

Posted - 09/22/2015 :  4:44:53 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Just noticed my script was wrong. Fixed it so now it reads:

wunstackcol irng1:=col(D) irng2:=col(A) ow:=Sheet1!;
wunstackcol irng1:=col(E) irng2:=col(A) ow:=Sheet2!;
wunstackcol irng1:=col(F) irng2:=col(A) ow:=Sheet3!;
wunstackcol irng1:=col(G) irng2:=col(A) ow:=Sheet4!;
etc.

Now I'm trying to get it to extract to a specific column (col(2)-col(11)). How do I impliment that?
Go to Top of Page

SeanMao

China
288 Posts

Posted - 09/23/2015 :  11:22:50 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can use colcopy function to copy columns to desired columns:

http://www.originlab.com/doc/X-Function/ref/colcopy

Regards!

Sean
Go to Top of Page

Men Bro

2 Posts

Posted - 10/22/2015 :  11:59:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
quote:
Originally posted by SeanMao

Hi,

You can use colcopy function to copy columns to desired columns:

http://www.originlab.com/doc/X-Function/ref/colcopy

Regards!

Sean



Thank you so much, It work for me too, that's exactly what i need!

Edited by - Men Bro on 01/05/2016 02:01:18 AM
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