MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn moreOpportunities for recent engineering grads.

Apply Today**Description**

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.

**Example**

in = 215 out = 6

256 correct solutions
435 incorrect solutions

Last solution submitted on Oct 14, 2015

4 players like this problem

1 Comment

Nick
on 3 Jul 2014

Function 'decimalToBinaryVector'is not recognized. Why not?

4 players like this solution

1 Comment

Cris Luengo
on 15 Jul 2012

dec2bin(x) doesn't work for me with a square matrix x (R2009b). Is this new functionality?

2 Comments