FUNCTION REFERENCE
num2str
Convert numbers to text.
Convert numbers to text.
Syntax
s = num2str(x)Syntax
s = num2str(x, precision)Syntax
s = num2str(x, format)Integers print in full. Otherwise every element gets floor(log10(m)) + 5 significant digits, where m is the largest finite abs(x), kept between 5 and 16; so pi gives '3.1416'. A matrix gives one text row per matrix row. precision is the number of significant digits. format is a sprintf format such as '%8.3f'. Character input is returned unchanged. Complex and logical input is accepted.
Example
num2str(pi, 8) % '3.1415927'Differences from MATLAB: Complex input with a format is not supported yet.
These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.