Return the number of 1s in the (unsigned integer) binary representation of a number. This function should be able to provide vectorized input and return an output with the same dimensions as the input.
in = 215 out = 6
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry PiLearn more
Opportunities for recent engineering grads.Apply Today
New to MATLAB?Learn MATLAB today!
Play games and win prizes!Learn more