필터 지우기
필터 지우기

How to do this copying from matrix to random matrix ?

조회 수: 3 (최근 30일)
Firas Al-Kharabsheh
Firas Al-Kharabsheh 2016년 5월 2일
if i Generate a binary random (n,m) matrix and after some steps i found A_matrix like this
A_matrix = [ 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 1 0 0
1 1 1 1 1 1 1 0 1 1
0 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 1 0 0
1 0 0 0 0 0 0 1 0 0 ]
i want to generate another randomly matrix but i want
  • the row that have more than the half of ones compered by m (number of ones > m/2) copy as it is in the new matrix
  • the column that have more than the half of ones comperd by n (number of ones > n/2) copy as it is in the new matrix
X_before = [ 1 0 0 1 0 0 1 0 1 0
1 0 1 0 0 0 1 0 1 0
0 1 0 1 0 1 0 0 0 0
0 0 1 0 1 0 0 1 0 1
0 1 0 1 0 1 0 0 1 1
0 0 1 0 1 1 1 0 0 0 ]
X_after = [ 1 1 1 1 1 1 1 1 1 1
0 0 1 0 0 0 1 1 0 0
1 1 1 1 1 1 1 0 1 1
0 1 0 1 0 1 0 1 0 0
1 0 1 0 1 0 0 1 0 1
1 1 0 1 0 1 0 1 1 1 ]
where A_matrix (1,:) and (3,:) and (:,8) are equal to X_after (1,:) and (3,:) and (:,8)
  • note i do not need to use this way A_natrix(1,:) = X_after(1,:) because its can be change if the A_matrix changed

답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by