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
 Deleting columns.
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

sabpalazzese

Germany
2 Posts

Posted - 01/17/2021 :  07:18:17 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello everyone,

I'm trying to delete all empty columns at once using labtalk. I was trying to define a range selecting by hand the empty columns and then deleting the range. However the columns are not always the same and this is a lot of work.

Is there a way that I can easily do this using the command or script window?

Thanks in advance.

cpyang

USA
1406 Posts

Posted - 01/17/2021 :  2:50:27 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I am afraid there is no LabTalk access for finding the first empty column from the end, but there is Origin C access, like this

	Worksheet wks = Project.ActiveLayer();
	int nCols = wks.GetNumCols();
	int n1 = wks.FindFirstEmpty(0, true);
	wks.DeleteCol(n1, 0, nCols-n1);


We can add this to LT wks method, as it is also available in automation server, so it is simple to add this to LT and thus can be used from Python.

CP
Go to Top of Page

sabpalazzese

Germany
2 Posts

Posted - 01/21/2021 :  04:48:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, however, when I try using this code in Origin C it doesn't compile. I have never used Origin C so maybe I am doing something wrong. I will read the user guide and try again.
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 01/21/2021 :  07:16:02 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We added LabTalk access as wks.MaxCols, maybe you would like to try in a beta? code will look like


range rr=$(wks.maxcols+1):$(wks.ncols);
del rr;


CP
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