compare the absolute value of each element from two matrices
Ältere Kommentare anzeigen
I have two matrices A and B with the size NxM and I want to compare the absolute value of each element for the two matrices and return the bigger value and then to store the real value in a new matrix.
Any suggestions please
Many thanks in advance
3 Kommentare
Image Analyst
am 25 Nov. 2014
How are we suppose to know which elements from A or B are the "real" values? Or do you mean "real" as in complex - are A and B complex numbers? Please give a small numerical example.
Jack_111
am 25 Nov. 2014
Image Analyst
am 25 Nov. 2014
OK. Good. Calling it the "real" value instead of the "max" value was a major oversight initially. But now that you've clarified it, it looks like you now have two correct solutions. Thanks for accepting one of them. You can also vote for both of them too, even though you can accept only one.
Akzeptierte Antwort
Weitere Antworten (1)
the cyclist
am 25 Nov. 2014
Bearbeitet: the cyclist
am 25 Nov. 2014
absA = abs(A);
absB = abs(B);
I'm not sure what you mean by "compare ... and return the real value". Larger? Smaller? Difference?
2 Kommentare
Jack_111
am 25 Nov. 2014
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!