How do I compare two similar sized matrices?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Lakyn
am 21 Aug. 2016
Kommentiert: per isakson
am 22 Aug. 2016
Hi all!
I have two 76x2000 matrices and I would like to compare them to see which one is always higher. What is the best way for me to go about this? A function that would allow me to put in different pairs would be most appreciated.
Thank you!
6 Kommentare
per isakson
am 22 Aug. 2016
Bearbeitet: per isakson
am 22 Aug. 2016
"what do you mean by a 76x2000 logical array"   there is a good answer in the middle of Introducing MATLAB Fundamental Classes (Data Types)
I still don't fully understand what you mean by "matrices have a higher value". The example you provided above explains "higher" regarding scalars, not matrices. Please give a small example regarding matrices. See Norm (mathematics) and Vector and matrix norms.
Akzeptierte Antwort
per isakson
am 22 Aug. 2016
Bearbeitet: per isakson
am 22 Aug. 2016
"every single value in that matrix [ A ] is higher than the corresponding one in the other matrix [ B ]"
is_gt = A > B;
is_higher = all( is_gt(:) );
(:) is a trick to reshape a matrix to a column vector.
6 Kommentare
per isakson
am 22 Aug. 2016
Secondly, try
is_gt = mean(A,1,'omitnan') > mean(B,1,'omitnan');
is_higher = all( is_gt(:) );
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!