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
 Replace label row values, wreplace not working

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
dekos Posted - 07/22/2021 : 07:59:08 AM
Origin Ver. and Service Release (Select Help-->About Origin): 2020b
Operating System: Win10

Hello.
When importing my files I have to replace label values, long names etc., e.g. "<I>" should be "current". Unfortunately, the wreplace function does not look in label rows - but the GUI version does (when specific option is ticked).
Is there a way to do it in command line (with wreplace)?
Thanks!
3   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 07/22/2021 : 12:02:42 PM
You will need to check each column label, like the script below. Please check the table for the header row characters:
https://www.originlab.com/doc/LabTalk/ref/Column-Label-Row-Characters#Column_Label_Row_Properties


for (int i = 1; i <= wks.ncols; i++)
{
	if (wcol(i)[L]$ == "100mM" || wcol(i)[L]$ == "50mM") 
		wcol(i)[L]$ = "100 mol/L"; 

	if (wcol(i)[C]$ == "100mM" || wcol(i)[C]$ == "50mM") 
		wcol(i)[C]$ = "100 mol/L"; 

	//
	//

}
dekos Posted - 07/22/2021 : 10:25:17 AM
Thank you! That's a good workaround.

Just in case someone has any parameter to replace. The format is always "100mM" or "50mM" but you need "100 mol/L" etc. - how do you search every field in column label row?
YimingChen Posted - 07/22/2021 : 09:46:48 AM
We will improve the XFunction to support search column label row. For now, if you want to search column longname and replace "<I>" by "current", you have to loop over all columns, see script below:


for (int i = 1; i <= wks.ncols; i++)
{
	if (wcol(i)[L]$ == "<I>") 
		wcol(i)[L]$ = "current"; 
}


James

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