how to construct 4x2 matrix taking value 0 and 1 randomly? No rows should be repeated.
1 回表示 (過去 30 日間)
古いコメントを表示
for example 4x2 matrix, the output should be [1 0;1 1;0 1; 0 0]. In this matrix no rows are repeated. I uses the code randi([0,1],4,2). I got 4x2 matrix but getting repeated row like [1 0;1 1;1 0; 0 0].Here, row1 and row3 are same, which is not acceptable.
please help to construct the matrix without any repeation of rows.
0 件のコメント
回答 (2 件)
Andrei Bobrov
2017 年 1 月 18 日
編集済み: Andrei Bobrov
2017 年 1 月 18 日
One of ways:
dec2bin(0:3)-'0'
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!