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
 multiple custom column sorting
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

hugh0136

Australia
Posts

Posted - 05/22/2006 :  12:27:10 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR4
Operating System: PC

Hello
I have imported numerous data files into the same worksheet. Each data file consists of an x and y column. I want to sort the y column of each data set in descending order while keeping the corresponding x value of each y point next to it. I am currently doing this manually by highlighting A(X1) and B(Y1)
analysis > sort columns > custom > highlighting B(Y1) > descending
and then doing the same for the next set C(X2) and D(Y2).
Is there a way of automating this?
thanks
Rachel

Edited by - hugh0136 on 05/22/2006 12:55:44 AM

Deanna

China
Posts

Posted - 05/22/2006 :  02:22:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello, Rachel.

You may use Labtalk script to automate the sorting. Suppose you have 3 pairs of x and y columns, and they are arranged in the worksheet like:
X1, Y1, X2, Y2, X3, Y3
Then you can use the following code:

NumPairs=3;
for (ii=0; ii<NumPairs; ii++)
{
XIndex=ii*2+1;
type $(XIndex);
sort -cd $(XIndex) $(XIndex+1) col($(XIndex+1));
};



Paste the code into the Script Window, highlight all the codes and press enter. Then the worksheet will be sorted.

You may change the number of column pairs to suit your need, just by modifying the number (in red) in the first line.

Deanna
OriginLab GZ Office
Go to Top of Page

hugh0136

Australia
Posts

Posted - 05/22/2006 :  10:08:17 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks works great :)
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