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
|