필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Compare matrices from different programs

조회 수: 1 (최근 30일)
fiona rozario
fiona rozario 2017년 2월 21일
마감: MATLAB Answer Bot 2021년 8월 20일
I have two matrices created from two different programs. Matrix A from program A and matrix B from program B. The matrix sizes are same and I want to compare the elements of these matrices. Is that possible? If yes, how?

답변 (2개)

Jan
Jan 2017년 2월 21일
If the matrices are small, you can subtract them:
A - B
abs(A- B)
If they are too large to keep the overview in the command window:
D = abs(A - B);
max(D(:))
min(D(:));
You can draw the difference:
Img = A - B;
Img = Img - min(Img(:));
Img = Img / max(Img(:)); % Normalize to [0, 1]
image(Img);
If you only want to check, if the matrices are equal:
isequal(A, B)
  댓글 수: 2
Rik
Rik 2017년 2월 21일
Well, this is what you get from not being clear on how you precisely want to compare the matrices ;)
Jan
Jan 2017년 2월 22일
@Rik: And the detail that the matrices are comming from "two different programs" has not been considered. I hope that fiona gets inspirated by our suggestions.

Rik
Rik 2017년 2월 21일
A = [3 4;8 9];
B = [3 6;0 4];
AreElementsEqual = A==B ;

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by