A = cat( 3, [1 2 3; 9 8 7; 4 6 5], [0 3 2; 8 8 4; 5 3 5], ... [6 4 7; 6 8 5; 5 4 3]); % The EIG function is applied to each of the horizontal 'slices' of A. for i = 1:3 eig(squeeze(A(i,:,:))) end