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

조회 수: 1 (최근 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 CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by