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
Forum
Support
Gallery
Igor Pro 10
Learn More
Igor XOP Toolkit
Learn More
Igor NIDAQ Tools MX
Learn More
August 28, 2014 at 04:10 am - Permalink
We don't need a function:
July 21, 2025 at 01:46 pm - Permalink
Note that this is generally not such a good idea, since there is the possibility to loose precision on the way (especially when using num2str()). See:
You would at least want to control the precision, which can be done from Igor 9 onward using an optional formatStr.
July 21, 2025 at 11:38 pm - Permalink