Specify number of ones in each row and column in binary matrix

8 ビュー (過去 30 日間)
high speed
high speed 2021 年 4 月 3 日
コメント済み: high speed 2021 年 4 月 3 日
I want create random binary matrix of dimensions 972x1944 that contain 3 ones in each column and 6 ones in each row.
How can I do that please

採用された回答

Matt J
Matt J 2021 年 4 月 3 日
A=kron(eye(324),ones(3,6));
A=A(randperm(972), randperm(1944));

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by