randone1

버전 1.0.0.0 (1.02 KB) 작성자: Jos (10584)
random array with one 1 per row (and column)
다운로드 수: 25
업데이트 날짜: 2016/6/17

라이선스 보기

randone1 - produces a random array with one 1 per row and column
randone1(N) returns a N-by-N square array with zeros and N ones,
randomly distributed so that each row and each column contains a one 1.

randone1(N,M) where M > N returns a N-by-M array with zeros and N ones,
again with one 1 per row, randomly distributed over the M columns.

Examples
randone1(4,5)
% could yield [0 1 0 0 0 ; 0 0 0 1 0 ; 0 0 0 0 1 ; 0 0 1 0 0]

See also rand, randperm, sort,
nones, randswap (File Exchange)

인용 양식

Jos (10584) (2024). randone1 (https://www.mathworks.com/matlabcentral/fileexchange/57725-randone1), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2016a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
도움

받음: shake, NTRUE, RANDSWAP

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0