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
 Origin Forum
 Unstack based on number of columns
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

saconrad

USA
1 Posts

Posted - 01/15/2014 :  11:39:24 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 9.1.0 SR1
Operating System: Win 8

Is there a way to unstack a column based on the number of rows rather than a grouping variable?

e.g.
1
5
3
6
3
4

would be unstacked in groups of 2 rows to become:

1 5
3 6
3 4


Steven Conrad, MD PhD

Kathy_Wang

China
159 Posts

Posted - 01/16/2014 :  03:38:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

I think you could add another column and use it as the grouping range. In the new column, use the Set Column Values to set its formula as mod(i,2), which means the remainder that row index divided by 2, and then you will have a worksheet like below, and you could further use column B as grouping range to unstack column A and get your desired result.



Kathy
Originlab
Go to Top of Page

snowli

USA
1398 Posts

Posted - 01/16/2014 :  12:50:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Besides what Kathy suggested, if you have a 1 column worksheet, you can choose Worksheet: Convert to Matrix: Expand.
Set "Expand for Every Row/Col" to be 2
Click OK

It will reorganize the data but right now we only support matrix window as output.

So you have to select Matrix: Convert to Worksheet with direct method to change it back to a worksheet.

I will check if we can improve this Expand to support output to be a worksheet as well. I created jira https://originlab.jira.com/browse/ORG-10475

for this.

Thanks, Snow
OriginLab Corp.

Edited by - snowli on 01/16/2014 2:39:56 PM
Go to Top of Page

greg

USA
1379 Posts

Posted - 01/16/2014 :  4:52:12 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
There is also a very old LabTalk command to "unzip" a column into two:
copy -u col(source) col(destOdd) col(destEven)
as in
copy -u col(A) col(ODD) col(EVEN)

Change the "A" to match your source column, then copy and paste the line to the Command Window and press Enter.
Go to Top of Page

snowli

USA
1398 Posts

Posted - 03/06/2015 :  11:07:01 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We added an xfunction colsplit in Origin 2015 sr1 to support unstack columns by number of rows or by number of columns

Select column(s) you want to split and run colsplit -d in Script window to open the dialog.

Go to Top of Page

piotrczrnota

Poland
1 Posts

Posted - 03/07/2015 :  05:43:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for the solution, really helped me.
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