Для полностью векторизованной альтернативы попробуйте
B = (A + diag(Inf(size(diag(A))))); % put Inf on diagonal
[~,ndx] = min(B(:)); % get the linear index of the minimum value
[r,c] = ind2sub(size(A),ndx); % get row, column of corresponding to linear index