Generalized Truth Table
This function will create a truth table matrix of arbitrary base and # of bits.
abTruthTable(base,bits)
Ex: abTruthTable(4,2)
ans =
0 0
0 1
0 2
0 3
1 0
1 1
1 2
1 3
2 0
2 1
2 2
2 3
3 0
3 1
3 2
3 3
I had trouble finding something simple for what I wanted, and figured someone else might want it as well. I mostly use it for to create Binary Truth Tables, but on occasion I need permutations of up to 10 values, so this is nice to have on hand.
Happy coding.
引用
Brian Moore (2026). Generalized Truth Table (https://jp.mathworks.com/matlabcentral/fileexchange/44367-generalized-truth-table), MATLAB Central File Exchange. 取得日: .
MATLAB リリースの互換性
プラットフォームの互換性
Windows macOS Linuxカテゴリ
- MATLAB > Language Fundamentals > Data Types > Numeric Types >
- MATLAB > Language Fundamentals > Data Types > Tables >
- MATLAB > Language Fundamentals > Data Types > Numeric Types > Logical >
タグ
| バージョン | 公開済み | リリース ノート | |
|---|---|---|---|
| 1.0.0.0 |