A problem must detail what needs to be done in its description. There is not only one way to do what's requested. You should probably add more test cases too, at least 5, to avoid lookup table solutions.
1270 Solvers
Number of 1s in a binary string
3036 Solvers
215 Solvers
Relative ratio of "1" in binary number
413 Solvers
Matlab Basics - Create a row vector
281 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!