Help comparing two matrices
조회 수: 3 (최근 30일)
이전 댓글 표시
so I need to compare two matrices but I need to set the values the final compared matrice will have... so for example if one value is higher than the other it should display 1; if it is lower -1 and finally if it is equal 0. I have been messing with this but cant figure it out I think I need a way to go over the two matrices comparing the two elements and but then how do I set those elements back into a matrice....? why is it so complicated!!!
well i need a function... sorry and thanks for the quick responses
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2014년 12월 22일
편집: Azzi Abdelmalek
2014년 12월 22일
idxp=A>B
idxn=A<B
C=zeros(size(A))
C(idxp)=1;
C(idxn)=-1
댓글 수: 0
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!