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
 All Forums
 Origin Forum
 Origin Forum
 reverse dataset order

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
celarson Posted - 04/25/2003 : 4:53:53 PM
Is there a simple way to reverse(invert?) the order of data in a column? If I have 1,5,3,5,2 in rows 1..5 to start I want the order to be 2,5,3,5,1 when I'm done.

Right now I create another column, fill with row numbers and desending sort that to flip my data but that seems rather clunky. As always, apprecation for help on my simple questions.
1   L A T E S T    R E P L I E S    (Newest First)
Mike Buess Posted - 04/26/2003 : 08:02:03 AM
The following Origin C function copies the selected column to a one-row matrix, flips the matrix horizontally and copies the data back to the column. It may sound like a roundabout approach but it works fine.

void InvertColumn()
{
Worksheet wks=Project.ActiveLayer();
int c1,c2,r1,r2;
if( wks.GetSelection(c1,c2,r1,r2) != 26 ) return;

Dataset dd(wks,c1);
matrix mm(1,r2+1);
mm.SetByVector(dd);
mm.FlipHorizontal();
mm.GetAsVector(dd);
}

If you don't have Origin 7 you can write a LabTalk macro/script that does what you do now.

Mike Buess
Origin WebRing Member

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000