The max matrix of two matrices
Mostra commenti meno recenti
Hello,
If I have two N-by-N matrices A and B, how can I find the N-by-by matrix C such that its (m,n)th element is the max of the (m,n)th element in A and the (m,n)th element in B?
Note: I don't want to use a for loop because N is quiet large.
Thanks
Risposta accettata
Più risposte (1)
Ben11
il 7 Ago 2014
Try this:
C = arrayfun(@(x,y) max(x(:),y(:)),A,B)
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!