int2str
Rounds numbers to integers and returns them as text.
Category: Language Fundamentals > Data Types
Syntax
s = int2str(N)
Returns the rounded values as a character array.
Description
int2str(N) equals num2str(round(N)). Ties round away from zero, so int2str(2.5) is '3'. It does not give control over the format; use sprintf or num2str with a format string for that.
Input arguments
N- Numeric array.
Output arguments
s- Character vector (or char matrix, one row per row of
N) with the rounded numbers separated by spaces.
Example
Rounded text
int2str(3.7)
int2str(2.5)
int2str(1e3*pi)
Output
ans = '4'
ans = '3'
ans = '3142'