Recursive Bit Combinations

Version 1.0.0.0 (325 Bytes) by Elad Azaria
Creates a matrix (size 2^n X n) of all Bit combinations for input integer n.
26 Downloads
Updated 24 May 2017

View License

Given an input n the function recursively creates a matrix of 2^n by n which includes all possible Bit combinations for a length n Bit array.
I looked for a recursive implementation and didn't found so i made one.
It works by copying the basic unit [1; 0] and than the larger units build from it adjacent to a column vector of n/2 ones and n/2 zeros

Cite As

Elad Azaria (2026). Recursive Bit Combinations (https://www.mathworks.com/matlabcentral/fileexchange/63040-recursive-bit-combinations), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Discrete Math in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

-none