How to use num2str( ) In MATLAB
The num2str() function is used to convert the specified numbers to a character array.
Syntax: num2str(num)
Parameters: This function accepts a parameter.
- num: This is the specified number.
Example:
Matlab
% MATLAB code for removal of % decimal points without rounding % Initializing some values num2str(3.1455567, '%.0f' ) |
Output:
ans = 3
How to remove decimal in MATLAB?
In this article, we are going to discuss the “Removal of decimal point” in MATLAB which can be done using sprintf(), fix(), floor(), round() and num2str() functions which are illustrated below.