Multiple Wave Renaming

Hi all,

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
Function RePrefixAllWaveNamesInCurrentFolder(oldprefix,newprefix)
   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
Thanks for your help but I couldn't finally manage. I introduced the following procedure:
Function RePrefix(air,a)
   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?
You might read the manual about string variables, in particular to understand this segement of code:

Function CreateAVacuum()
   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
xavsd wrote:
Thanks for your help but I couldn't finally manage. I introduced the following procedure:
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?

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 air = "air"
String/G a = "a"
RePrefix(air, a)

or
RePrefix("air", "a")