Batch Math program problem

I am writing a program to perform batch wave arthmitic and am running into issues with the coding.

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
The numeric value needs to be converted to a string for your use
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

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More