How to use floor() In MATLAB
The floor() function is used to round the specified values towards minus infinity.
Syntax:
floor(A)
Here, floor(A) function is used to round the specified elements of A to the nearest integers less than or equal to A.
Example:
Matlab
% MATLAB code for removal of % decimal points using floor() % Initializing some values A = 2.000; B = 1.790; C = 0.9093; % Calling the floor() function over % the above values floor(A) floor(B) floor(C) |
Output:
ans = 2 ans = 1 ans = 0
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.