Author |
Topic  |
|
Naughtje
USA
3 Posts |
Posted - 09/21/2015 : 7:56:47 PM
|
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
|
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
|
 |
|
Naughtje
USA
3 Posts |
Posted - 09/22/2015 : 4:05:22 PM
|
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. |
 |
|
Naughtje
USA
3 Posts |
Posted - 09/22/2015 : 4:44:53 PM
|
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? |
 |
|
SeanMao
China
288 Posts |
|
Men Bro
2 Posts |
Posted - 10/22/2015 : 11:59:12 PM
|
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 |
 |
|
|
Topic  |
|