how to copy rows and columns in a random matrix ?
조회 수: 1 (최근 30일)
이전 댓글 표시
if i have matrix A
A = [ 1 0 1 1
0 0 1 0
0 1 0 1
1 1 0 1 ] ;
THEN i want to generate a random binary matrix S which the first and last row IN A appear in S matrix
AND the last column In A appear in S matrix ?
S = [ 1 0 1 1
0 1 0 0
1 0 1 1
1 1 0 1 ]
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2016년 4월 18일
S=randi([0 1],size(A))
S([1 end],:)=A([1 end],:)
S(:,end)=A(:,end)
댓글 수: 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!