Recursive Bit Combinations

Creates a matrix (size 2^n X n) of all Bit combinations for input integer n.

You are now following this Submission

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://in.mathworks.com/matlabcentral/fileexchange/63040-recursive-bit-combinations), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0

-none