Change numeric wave to textwave with full precision.
kim100
Hi,
I want to change a numeric wave (WaveNumber) to a textwave (WaveText) with keeping full precision of the values in the numeric wave.
The method I use is "Make/O/T/N=(5,10) WaveText=num2str(WaveNumber)"
But, it is well known that, when "num2str" function used, "Precision is limited to only five decimal places"
Is there any way to do this change without losing precision ?
Thanks !
Here's a user-defined replacement for num2str() that allows you to control the precision:
String result=""
sprintf result, "%.*g", prec, num
return result
end
For "full" precision with a double-precision value, use 16 or 17.
January 6, 2022 at 12:39 pm - Permalink
In Igor Pro 9, num2str takes an optional precision parameter so you could use:
Make/O/T/N=(5,10) WaveText=num2str(WaveNumber,"%.16g")
Depending on what your application is, instead of creating a text wave, it might be better to do the conversion wherever you are currently using the text wave.
January 6, 2022 at 01:41 pm - Permalink