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
 split one data column into multiple
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Butterfly98

2 Posts

Posted - 11/21/2013 :  05:02:56 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi there,

I have a series of measurements in one data column, and to plot this I need the data of each measurement in one separate column.
I have already managed to separate the column using

copy -b 1 col(1) Col(2) -b 1 -e 125
copy -b 126 col(1) Col(3) -b 1 -e 125
copy -b 251 col(1) Col(4) -b 1 -e 125

, meaning that Origin is supposed to copy the first 125 data points from column 1 to column2, the second 125 data points from column 1 to column3, and so on.

However, I have 12250 rows, or 98 columns with 125 data points each, so writing a script like that will take considerable time.

So my question is: How can I write a kind of loop for that function which would also make it easy to change the number of points?

A very similar problem was discussed here in 2010 already (http://originlab.com/forum/topic.asp?TOPIC_ID=8731) but the suggestions there do not work.

I use OriginPro 8.5.0.

Thanks in advance for any help!

Castiel

343 Posts

Posted - 11/21/2013 :  09:18:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You may write a LabTalk function.For example,
function int foo(int n,int t)
{
    for(int i=1;i<=t;i++)
    {
        range rr=col(1)[n*(i-1)+1:n*i];
        range dst=wcol(i+1)[1:n];
        dst=rr;
    }
    return 0;
}
newbook;
col(1)={1:12250};
foo(125,98);


妾+   午旦  妹罕妾  妾伊    用仇  妾/     岫ㄞ
 妾京用 仍巨  件 侈   件戶' 甘岫平   /欠  白岫妹
   併             艮          岫  奈 白   岫
                              岫
Go to Top of Page

Butterfly98

2 Posts

Posted - 11/21/2013 :  09:40:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you, Castiel, for your answer!

I just changed one thing in the last but one row:

col(1)=rr,

and the loop worked excatly like I hoped!!!
Thank you so much!!!
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