Given a positive, scalar integer n, create a (2^n)-by-n double-precision matrix containing the binary numbers from 0 through 2^n-1. Each row of the matrix represents one binary number. For example, if n = 3, then your code could return
>> binary_numbers(3)
ans =
1 1 1 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 1 1 0 1 0 1
The order of the rows does not matter.
2220 Solvers
470 Solvers
middleAsColumn: Return all but first and last element as a column vector
276 Solvers
Find a subset that divides the vector into equal halves
257 Solvers
Cell Counting: How Many Draws?
152 Solvers
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply Today