Function To Generate Truth Table Condition Vectors

버전 1.7.0.0 (1.49 KB) 작성자: Paul Metcalf
This function efficiently generates a matrix of binary condition vectors for use in a truth table.
다운로드 수: 1.9K
업데이트 날짜: 2011/4/25

라이선스 보기

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

인용 양식

Paul Metcalf (2024). Function To Generate Truth Table Condition Vectors (https://www.mathworks.com/matlabcentral/fileexchange/30008-function-to-generate-truth-table-condition-vectors), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.7.0.0

Further minor refinement of code.

1.6.0.0

The submission is updated to correct performance issues accidentally introduced in the previous version, as well as address the comments of James Tursa.

1.4.0.0

Added screenshot to download page.

1.3.0.0

The algorithm is now up to 33% faster thanks to the excellent 'Guideline on writing clean and fast code in MATLAB' by Nico Schlömer.
This should now be the simplest, fastest and most direct way of generating a truth table in MATLAB.

1.1.0.0

Slightly updated function description.

1.0.0.0