How I equate the arrangement of elements two matrices???

조회 수: 1 (최근 30일)
Immanuel Saragih
Immanuel Saragih 2018년 6월 24일
댓글: Walter Roberson 2018년 6월 24일
I have two matrices with the same size 5x5, the element of the two matrices is 0 and 1 but arrange of the element is different, and now i want to equate the element of the two matrices, arrangement of elements in matrices B must same with arrangement of elements in matrices A , without eliminate the elements in matrices B
If you know the way please help me....
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 6월 24일
What would the expected answer be?
At first I thought perhaps you were asking for the permutation matrix between the two, but we can see that B is not a permutation of A, because A has both rows and columns that are all 1's but B has no rows or columns that are all 1's.
Immanuel Saragih
Immanuel Saragih 2018년 6월 24일
Yes, A and B is not related matrix, it is different, i just want the position of 0 and 1 in matrix B same with matrix A eventhough not all element

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2018년 6월 24일
[R, C] = find(A == B);
  댓글 수: 5
Image Analyst
Image Analyst 2018년 6월 24일
"i expected B same with A eventhough not all it's element....." I hope you can see that this makes no sense whatsoever. If it's the same, all elements match. If all elements don't match, it's not the same.
Immanuel Saragih
Immanuel Saragih 2018년 6월 24일
So how if the number of each element 0 and 1 is same in A and B.... could you told me the way??

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2018년 6월 24일
Why can't you simply do
B = A;
This will make the "arrangement of elements in matrices B must same with arrangement of elements in matrices A" just like you asked for.
  댓글 수: 5
Walter Roberson
Walter Roberson 2018년 6월 24일
편집: Walter Roberson 2018년 6월 24일
More likely
B(A==1) = 1;
Walter Roberson
Walter Roberson 2018년 6월 24일
The Crystal Ball Toolbox is saying, "Concentrate and ask again."

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Condensed Matter & Materials Physics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by