MATLAB: Removing lowest value in each line from a matrix

value

Hi everybody, Can you help remove the lowest value from each line of a matrix?

Best Answer

Here's one way. Possibly not the most compact, but easy to understand, and there's something to be said for that.
A = [0 7 7 4; -3 4 10 12; 10 12 12 4];
[rows, columns] = size(A);
B = zeros(rows, columns-1);
for row = 1 : rows
thisRow = A(row, :); % Get this one row.
[~, indexOfMin] = min(thisRow); % Find index of the min.
thisRow(indexOfMin) = []; % Delete the min element.
B(row, :) = thisRow; % Stuff it into B
end
% B is the output.
Andrei will provide a one-liner shortly, I'm sure.