Function To Generate Truth Table Condition Vectors
This function returns a matrix of all possible binary condition vectors for a logical system with (I) inputs.
The number of inputs is limited only by the user's available system memory. The function is highly efficient, written using only three variables in 16 lines of MATLAB code.
While this is longer in terms of lines than similar functions on MATLAB CENTRAL, it is the quickest and most direct function that obtains the solution (and the only function that doesn't depend on other functions to achieve the result).
INPUT: (I) shall be an integer >= 1
OUTPUT: CONDVECTS is a binary matrix of size [2^I,I]
USAGE: GETCONDVECTS(3)
ans =
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1