
Merging multiple matrices
Posted:
May 9, 2013 9:44 AM


Dear,
I am trying to efficiently merge multiple matrices, combining their maximal values. For example: If A = [1 1 2; 1 2 1; 2 1 1] and B = [3 1 1; 1 3 1; 1 1 3], then their maximal values combined would be: C = [3 1 2; 1 3 1; 2 1 3]. I want to combine multiple matrices like this, up to 10. And these matrices can be quite big, up to 2000x2000.
At the moment I have several loops, which consider for every position (x,y) which of the values in each of the matrices is largest and then writes the largest to position (x,y) of the combined matrix.
It works fine, but can take very long, up to 20 minutes. Does anyone know of a more efficient method to achieve the same?
Thanks for any help.
Regards, Martijn

