# num2str

## Purpose

Number to string conversion.

## Synopsis

    s = num2str(x)
    s = num2str(x,precision)

## Description

`num2str` converts numbers to their string representations. This function is useful for labeling and titling plots with numeric values.

`s = num2str(x)` converts the scalar number `x` into a string representation `s` with roughly four digits of precision and an exponent if required.

`s = num2str(x,prec)` converts the scalar number `x` into a string representation `s` with maximum precision specified by `precision`.

## Examples

`num2str(pi)` is `'3.142'.`

`num2str(eps)` is `'2.22e-16`'.

## Algorithm

`num2str` uses `sprintf`. If desired, the file can be modified to change the number of digits.

## See Also

    fprintf, hex2num, int2str, setstr, sprintf

(c) Copyright 1994 by The MathWorks, Inc.