does matlab round down? in matlab

To round a number to the nearest lower integer, you can use the floor function in Matlab. Here's an example:

main.m
number = 3.8;
rounded = floor(number);
disp(rounded); % 3
58 chars
4 lines

The floor() function always returns the nearest integer that is less than or equal to the input number. So in this example, it returns 3 which is the next lower integer to 3.8.

related categories

gistlibby LogSnag