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
 how to delete a element of a 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

kitten_li

USA
Posts

Posted - 07/30/2006 :  11:37:37 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version: 6.0
Operating System: WinXP

Hi LabTalk experts,
I'm just wondering which command can I use in the
LabTalk script to delete an element of a column.
Just exactly as clicking "Edit->Delete" after
selected/highlighted that cell.

Thanks a lot!

Deanna

China
Posts

Posted - 07/31/2006 :  12:28:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi, you may use the following command:
mark -d dataset range

For example, to delete the 4th to 6th cells of Row 2, use the script window:
mark -d col(2) -b 4 -e 6;


Deanna
OriginLab GZ Office
Go to Top of Page

kitten_li

USA
Posts

Posted - 07/31/2006 :  09:46:09 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Deanna for your reply!
However, by using "mark -d", the same
rows of all the columns will be deleted.
Suppose I have col(A) and col(B), how can
I just delete col(A)[1] while keep col(B)[1]
intact?

Thank you very much!
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/31/2006 :  10:19:18 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
This LabTalk script deletes row nn from col A without changing other columns in the same worksheet...

nn=5; // delete row 5;
get col(A) -e npt; // npt is # rows in col(A)
if( nn>npt ) return;
npt-=1;
copy -b (nn+1) col(A) col(A) -b nn -e npt;
set col(A) -e npt;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/31/2006 10:20:21 AM
Go to Top of Page

kitten_li

USA
Posts

Posted - 07/31/2006 :  11:15:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you so much Mike.
Your "copy" solution works well only with column containing data of the same type (all elements are numeric or text).
However, if you have a column that is of the "Text&Numeric" type, and
you just want to delete those cells with a certain numeric value, this "copy" solution still has a problem. All the cells with a text content would appear as "-" after running this script.
Do you have any idea about how to solve this problem?

Thank you again!
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/31/2006 :  12:26:25 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Easiest way is to select the cell you want to delete and then execute Edit > Delete with the menu -e menuID. This tip describes how to find menuID.

wo -s 1 5 1 5; // select col 1, row 5
menu -e 36442; // Delete

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/31/2006 12:48:53 PM
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