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 |
|
|