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
 Revert Elements in the 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
gstiago Posted - 02/24/2016 : 10:46:54 AM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 8.5 SR1
Operating System: Windows 7 64 bits

Is possible revert the columns in Labtalk ( origin 8.5) without using loops comands? I need revert a column with 2402 rows. But, I Just want REVERT the elements in this column...

My Best Regards,

Tiago

T. G. Santos
3   L A T E S T    R E P L I E S    (Newest First)
Hideo Fujii Posted - 02/25/2016 : 12:21:59 PM
Hi Tiago,

>There is a way to put it in a function... ??

Here is what you can do:

1) In your User Files Folder, using the Notepad, make a script file, say myUtilities.ogs ,
which contains the definition of the function in the following code:
[Main]
@global=1; //make the function global
function double revert (double colpos) {
	// colpos: Specify which col to be reversed
	nc=wks.ncols+1; //number of columns
	range rr=wcol(colpos);
	nr=rr.getSize(rr); //number of rows
	wcol(nc)=data(1,nr,1); //generate sequence in added column
	sort.cname1$="D: "+ wks.col$(nc).name$; //Set sequence in descending
	sort.c1=colpos; sort.c2=colpos; //subjected columns
	sort.r1 = 1; sort.r2 = nr;  //subjected rows
	sort.wks(); //execute sorting
	del wcol(nc); //delete added column
	return colpos;
}
@global=0; //restore global setting
2) Also in the UFF, edit Origin.ini to insert the following line in the [Startup] section:
file1=myUtilities.ogs


Now, you can use this revert function (which takes a single argument) anytime in your Origin session.

Hope this helps.

--Hideo Fujii
OriginLab
gstiago Posted - 02/25/2016 : 08:44:58 AM
Dear Hideo Fujii,

Its works great!! thank you!

There is a way to put it in a function or some method to condense this in one structure??

Thanks Again..

My Best Regards Tiago.

T. G. Santos
Hideo Fujii Posted - 02/24/2016 : 4:48:11 PM
Hi Tiago,

The following method using the sort object should work, though there may be
a more elegant method:
/////////////////////////////////////
colpos=2; //Specify which col to be reversed
nc=wks.ncols+1; //number of columns
range rr=wcol(colpos);
nr=rr.getSize(rr); //number of rows
wcol(nc)=data(1,nr,1); //generate sequence in added column
sort.cname1$="D: "+ wks.col$(nc).name$; //Set sequence in descending
sort.c1=colpos; sort.c2=colpos; //subjected columns
sort.r1 = 1; sort.r2 = nr;  //subjected rows
sort.wks(); //execute sorting
del wcol(nc); //delete added column
/////////////////////////////////////
Please try.

--Hideo Fujii
OriginLab

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