Convert text wave into numeric wave and vice versa

// Handy Function to convert numeric waves into text waves
Function ConvertNumWvToTxtWv(W)
Wave W
Variable np = numpnts(W)
Make /T /O /N=(np) TxtConvert
Variable x
for(x=0;x<np;x+=1)
    TxtConvert[x] = num2str(W[x])
endfor
End

// Handy Function to convert text waves into numeric waves
Function ConvertTxtWvToNumWv(W)
Wave /T W
Variable np = numpnts(W)
Make /O /N=(np) NumConvert
Variable x
for(x=0;x<np;x+=1)
    NumConvert[x] = str2num(W[x])
endfor
End
How about using a wave assignment instead of a loop?
Function ConvertNumWvToTxtWv(W)
Wave W

Make /T /O /N=(numpnts(W)) TxtConvert
TxtConvert[] = num2str(W[p])
endfor
End
 
Function ConvertTxtWvToNumWv(W)
Wave /T W

Make /O /N=(numpnts(W)) NumConvert
NumConvert[] = str2num(W[p])
End

Forum

Support

Gallery

Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More