create all logic permutation array
Afficher commentaires plus anciens
how cloud i create all random logic array when the length is known
eg: length=3
arr=[ 1 0 0
0 1 0
0 0 1
1 1 0
0 1 1
1 0 1
1 1 1]
Réponses (2)
d = (1:2.^3-1)';
b = de2bi(d);
b
If you don't have the communications toolbox:
n = 3; % number of bits
LUT = dec2bin((0:2^n-1).',3)=='1'
Note the bit order. Also, this example includes 0
Catégories
En savoir plus sur Image Arithmetic dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!