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
 Origin Forum
 Labtalk: delete last character of longname

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
mariacm Posted - 02/01/2023 : 4:46:37 PM
In labtalk - how to delete the last character of the longname? My script works over many worksheets and my goal is to add a string fragment to the longname of two columns on each worksheet, but the last character (created at import) should be erased before the concatenation occurs.

Origin Ver. OriginPro 2022 (64-bit) SR1
Operating System: windows 10
5   L A T E S T    R E P L I E S    (Newest First)
mariacm Posted - 02/02/2023 : 11:46:27 AM
Thanks,
I tried that before, and the sheets ended up named Col(A)[L] instead of the actual value of the longname (maybe I didn't include de $ mark?). I tried it again and it worked just fine.
(I really try with the help, but it is not straightforward.)



quote:
Originally posted by snowli

wks.name$= col(A)[L]$

https://www.originlab.com/doc/LabTalk/guide/Worksheet-Basic-Operation

Some tips
In google search. Start the google search with originlab labtalk, e.g. originlab labtalk sheet name, usually u can find labtalk related info.

if you type wks.= // it will show all properties for wks.


Thanks, Snow



snowli Posted - 02/02/2023 : 11:29:53 AM
wks.name$= col(A)[L]$

https://www.originlab.com/doc/LabTalk/guide/Worksheet-Basic-Operation

Some tips
In google search. Start the google search with originlab labtalk, e.g. originlab labtalk sheet name, usually u can find labtalk related info.

if you type wks.= // it will show all properties for wks.


Thanks, Snow

mariacm Posted - 02/02/2023 : 11:19:35 AM
---a somewhat related question:
how to make a longname be the worksheet name?


quote:
Originally posted by mariacm

Perfect! Thanks.

mariacm Posted - 02/01/2023 : 6:21:30 PM
Perfect! Thanks.
snowli Posted - 02/01/2023 : 5:05:44 PM
Col(A)[L]$ refers to long name of column A.
https://www.originlab.com/doc/en/LabTalk/ref/Column-Label-Row-Characters
There are many string related labtalk functions
originlab.com/doc/en/LabTalk/ref/String-obj
So write col(A)[L]$=Left(col(A)[L]$,len(col(A)[L]$)-1)$ to keep left length-1 chars.

To loop through all columns
https://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs#Looping_over_Columns_and_Rows

for(int ii = 0; ii < wks.ncols; ii ++)
{
wcol($(ii))[L]$=Left(wcol($(ii))[L]$,len(wcol($(ii))[L]$)-1)$;
}

Thanks, Snow



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