Argument of max values of multiple 2D arrays
2 views (last 30 days)
I have several 2D arrays (let's say I have 3, with 5x10 dimension for each), each array corresponds to one argument:
A1 corresponds to the argument 10, A2 to the argument 20 and A3 to the argument 30.
What i would be interested in, would be to have an array in which I would have for each element the argument corresponding to the maximum of the values of the 3 arrays.
That's not very clear so I'll give an example, if I had two 2x2 arrays:
The array that I want would look like that:
I can't really figure out how to do it, is it possible to do it without a loop? (I got lots of arrays with big dimensions so that wouldn't be super convenient)
Thanks for your help!
p on 16 Apr 2022
This seems to do what you want.
clc; clear all; close all;
A1=[1,2,3 ; 4,5,6 ; 7,8,9];
A2=[2,2,3 ; 3,4,5 ; 5,6,7];
A3=[0,1,2 ; 3,4,5 ; 9,9,6];