Problem 2891. Binary code (array)
Write a function which calculates the binary code of a number 'n' and gives the result as an array(vector).
Example:
Input n = 123 Output y =[1,1,1,1,0,1,1]
Solution Stats
Problem Comments
-
1 Comment
Cullen Walsh
on 23 Jun 2022
This is a good problem, but it would be useful as the first problem in the list since you use this as a building block in all the other problems.
Solution Comments
Show commentsProblem Recent Solvers1481
Suggested Problems
-
Renaming a field in a structure array
1564 Solvers
-
15712 Solvers
-
Generate a vector like 1,2,2,3,3,3,4,4,4,4
13011 Solvers
-
1179 Solvers
-
Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock.
951 Solvers
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!