Assigning New Matrix Elements Based On Comparing 2 Matrices
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Kiran
am 16 Feb. 2014
Beantwortet: Kiran
am 16 Feb. 2014
Say I have 2 Matrices of equal dimensions, say A and B. I need to compare them element by element. If the element in A is greater than the like for like element in B, assign a '1' for that like for like element in C. For when the like for like elements in A and B are equal, assign the value '2' in C. I have played around with the max function and a few inequalities but to no avail. Any help will be greatly appreciated.
0 Kommentare
Akzeptierte Antwort
Andrei Bobrov
am 16 Feb. 2014
Bearbeitet: Andrei Bobrov
am 16 Feb. 2014
C = (A >= B) + (A == B);
0 Kommentare
Weitere Antworten (1)
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!