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 for Programming
 LabTalk Forum
 flip a column

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
G.Bartsch Posted - 11/17/2006 : 07:31:48 AM
what is the best way to flip a column? i mean making the former first value the last, the second the one before the last and so on...
thanks
4   L A T E S T    R E P L I E S    (Newest First)
easwar Posted - 12/09/2011 : 10:05:28 AM
Hi,

In 8.51 or later, there is a colreverse function.

In GUI, select a col (or a range or rows), then right click and select "Reverse Order" from the context menu.

From LabTalk script, you can run the XF associated with this menu, such as:

range r=1[5:10]; // col 1, rows 5 thru 10
colreverse r;


Easwar
OriginLab
stuzer Posted - 12/05/2011 : 11:31:48 PM
OK, another way:

You want to flip column A.
Mark an empty column -> right click -> set column values ->
write this: Col(A)[N+1-i]
N is a number of rows in column you want to flip.
G.Bartsch Posted - 11/17/2006 : 10:54:36 AM
thank you very much! works fine. nevertheless i assumed there was a more direct way, maybe one should implement something like that in later origin versions.
Mike Buess Posted - 11/17/2006 : 08:38:32 AM
This LabTalk script flips the first selected column...

if( !selC1 ) return;
get %(%H,selC1) -e npt;
if( !npt ) return;
wks.AddCol();
%(%H,wks.ncols) = data(1,npt);
sort -cd selC1 selC1 %(%H,wks.ncols);
del %(%H,wks.ncols);


This Origin C function flips all selected columns...
void flip_selected_columns()
{
Worksheet wks = Project.ActiveLayer();
vector<int> vv;
wks.GetSelectedColumns(vv);
int nSels = vv.GetSize();
if( !nSels ) return;
for(int ii; ii<nSels; ii++)
{
Dataset dd(wks,vv[ii]);
matrix mm(dd.GetSize(),1);
mm.SetByVector(dd);
mm.FlipVertical();
mm.GetAsVector(dd);
}
}


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 11/17/2006 08:52:38 AM

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