Multiple Wave Renaming
xavsd
is there any way to program a function to rename a number of waves?
for example: "air_SeparationXXXX", to "A_SeparationXXXX"
for XXXX= 0000, 0500
so as to avoid to rename them one by one by the Data--> Rename.. browser..
thanx,
xavier
string oldprefix, newprefix
string theList, theOne, theName
variable ic, nt
theList = WaveList("*",";","")
nt = ItemsInList(theList)
for (ic=0;ic<nt;ic+=1)
theOne = StringFromList(ic,theList)
theName = ReplaceString(oldprefix,theOne,newprefix)
rename $theOne $theName
endfor
return 0
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
March 26, 2008 at 05:53 am - Permalink
string air, a
string theList, theOne, theName
variable ic, nt
theList = WaveList("*air*",";","")
nt = 501
for (ic=0;ic<nt;ic+=1)
theOne = StringFromList(ic,theList)
theName = ReplaceString(air,theOne,a)
rename $theOne $theName
endfor
return 0
end
After typing RePrefix(air,a) in the command line, I get the following Syntax Error: "expected string variable or string function"
Is the procedure well built? Do you have any idea of the cause of this error?
March 31, 2008 at 03:22 am - Permalink
string air, noair
air = "air"
noair = ReplaceString("air",air,"")
print "This is air->" + air + "<- after loosing \"air\" ->" + noair + "<-"
return 0
end
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
March 31, 2008 at 05:34 am - Permalink
Unless air and a are global string variables, that is the cause of the error message you're getting.
Try either of the following:
String/G a = "a"
RePrefix(air, a)
or
March 31, 2008 at 05:56 am - Permalink
March 31, 2008 at 07:57 am - Permalink