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 for Programming
 LabTalk Forum
 Revert Elements in the column.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gstiago

Brazil
9 Posts

Posted - 02/24/2016 :  10:46:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Hideo Fujii

USA
1582 Posts

Posted - 02/24/2016 :  4:48:11 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

gstiago

Brazil
9 Posts

Posted - 02/25/2016 :  08:44:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 02/25/2016 :  12:21:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
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