Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Compare matrices from different programs

1 visualización (últimos 30 días)
fiona rozario
fiona rozario el 21 de Feb. de 2017
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
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?

Respuestas (2)

Jan
Jan el 21 de Feb. de 2017
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 comentarios
Rik
Rik el 21 de Feb. de 2017
Well, this is what you get from not being clear on how you precisely want to compare the matrices ;)
Jan
Jan el 22 de Feb. de 2017
@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 el 21 de Feb. de 2017
A = [3 4;8 9];
B = [3 6;0 4];
AreElementsEqual = A==B ;

La pregunta está cerrada.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by