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
 Deleting columns with specific 'long name'

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
annniia Posted - 08/27/2017 : 12:19:25 PM
Hi,

I have been trying to ease my data analysis with labtalk but so far unsuccesfully.
My datasets (about 150 of them) contain X_i, Y_i columns, about 35 of each. There are some X_i columns missing and I can't use the option to skip, because those missing columns are random between datasets. I would like to delete all columns which long name starts with X, except X_0, and I would like to apply this to a few datasets (sheets) at a time.

I already played with the option to set a range that includes several X_i columns but for the amount of data I would be doing that until Christmas

Here is what a dataset looks like:



Thanks in advance!
3   L A T E S T    R E P L I E S    (Newest First)
annniia Posted - 08/28/2017 : 3:36:42 PM
Works perfectly! Thank you so much!
nick_n Posted - 08/27/2017 : 6:00:01 PM
oops,
One bracket is missing, check this line:

if (strColLabelName.match(strArgument$) && !strColLabelName.match(strArgumentExclud$))

Nikolay
nick_n Posted - 08/27/2017 : 5:57:05 PM
Hi,
Just copy that in Script Window (Alt+Shift+3).
Change strArgument and strArgumentExclud as you wish.
That LT will loop all pages and columns in current book.
Best regards

string strArgument$="X*";
string strArgumentExclud$="X_0";
int ii, jj;

loop (jj, 1, page.nLayers)
{
page.active=jj;
worksheet -s;

loop (ii, 1, wks.nCols)
{

strColLabelName$=wcol(ii)[L]$;
if (strColLabelName.match(strArgument$) && !strColLabelName.matchstrArgumentExclud$)) wks.colSel(ii, 1);
}

domenu 36442;

}


Nikolay

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