Change numeric wave to textwave with full precision.

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:

Function/s num2str_Prec(Variable num, Variable prec)
    String result=""
    sprintf result, "%.*g", prec, num
    return result
end

For "full" precision with a double-precision value, use 16 or 17.

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.