![](/profiles/wavemetrics/themes/wavemetrics/logo.png)
Batch Math program problem
![](/sites/default/files/styles/thumbnail/public/default_images/Artboard%201_1.png?itok=jeHOCIXy)
sleepingawake86
The basic idea is I have 2 sets of waves: {wave0,....wave49} and {wave50,...,wave99}, and want to calculate
Absorb=-ln(wave0/wave50) etc.
The main issue is how do I use a variable to define a string name?
I tried: string Aname="wave"+(A0+ii)
but igor didn't like that. I have placed the code below
function Absorbance(A0,B0,AL) variable A0,B0,AL variable ii for(ii=0;ii<AL;ii+=1) wave Absorb string Aname="wave"+(A0+ii) string Bname="wave"+(B0+ii) string AbsorbName="Absorb"+(A0+ii) Absorb=-ln($Aname/$Bname) duplicate/o Absorb $AbsorbName endfor end
![](/sites/default/files/forum.png)
Forum
![](/sites/default/files/support.png)
Support
![](/sites/default/files/gallery.png)
Gallery
Igor Pro 9
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
string Aname = "wave" + num2str(A0 + ii)
but you will also need a reference to the waves before you can use them
Wave wA = $Aname
Wave wB = $Bname
then this work
Absorb = -ln(wA/wB)
By the way this really should have been posted in the General Forum
July 13, 2011 at 12:19 pm - Permalink