MATLAB: Round to Nearest Multiple of 4.

round

If my calculation gives, a= 45, I want 44. Some example: 20 would be 20, 13 would be 12, 10 would be 12 or 8. How to round the number like this way?

Best Answer

a=45;
k=4;
b=k*round(a/k);