The max matrix of two matrices

If I have two N-by-N matrices A and B, how can I find the N-by-N 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? What would be the simplest way to get the output equivalent to the MATLAB max(A,B) command?

Maybe try broadcasting? E.g. max.(A, B)


Of course :slight_smile: I am stupid. Thanks for a quick handle.