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
 Origin Forum
 Replace label row values, wreplace not working
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dekos

8 Posts

Posted - 07/22/2021 :  07:59:08 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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!

YimingChen

1640 Posts

Posted - 07/22/2021 :  09:46:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

dekos

8 Posts

Posted - 07/22/2021 :  10:25:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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?
Go to Top of Page

YimingChen

1640 Posts

Posted - 07/22/2021 :  12:02:42 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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"; 

	//
	//

}
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