MATLAB: Newbie: How to find and delete the min element of a matrix?

matrix reductionrow deletion

helllo every one, I would like to know how can i find the min: element value in a given (m by n)matrix and then delete that whole row where this value lies. e.g if any given matrix is M= [ 2 7 9 ; 8 1 6 ; 8 5 7 ], the lowest is M(2,2). is there any command that can I apply 1st to find this position and then to delete 2nd row and re-arrange the remaining 2 rows as a new matrix without this deleted 2nd row.

Best Answer

M= [ 2 7 9 ; 8 1 6 ; 8 5 7 ];
out = M(~any(min(M(:)) == M,2),:)
OR
[~,ii] = min(M(:));
[i1, ~] = ind2sub(size(M),ii);
out = M(setdiff(1:size(M,1),i1),:);
OR
[~,ii]= min(min(M,[],2))
out = M;
out(ii,:) = []
etc