Combine them in the 3rd dimension and use the SECOND output from max to get exactly what you want
A = rand(3,3); B = rand(3,3); C = rand(3,3); D = cat(3, A, B, C) [~, Solution] = max(D, [], 3)
eg:.
D = ans(:,:,1) = 0.70101 0.31706 0.83874 0.89421 0.33783 0.55681 0.68520 0.11697 0.45631 ans(:,:,2) = 0.268715 0.213200 0.124450 0.869847 0.999649 0.153353 0.345447 0.023523 0.338099 ans(:,:,3) = 0.216665 0.297900 0.604734 0.103340 0.767206 0.660668 0.127052 0.430861 0.021584 Solution = 1 1 1 1 2 3 1 3 1
source share