If I understood you correctly, try this:
clc;
workspace;
fontSize = 25;
close all;
r=[0.00 18.68 39.62 20.81 5.39 39.92
18.68 0.00 33.84 38.91 24.04 53.41
39.62 33.84 0.00 48.38 42.20 45.12
20.81 38.91 48.38 0.00 15.62 25.08
5.39 24.04 42.20 15.62 0.00 36.40
39.92 53.41 45.12 25.08 36.40 0.00];
[rows, columns] = size(r)
thisMin = -1*ones(rows, 1);
priorRowMin = 0;
for row = 1 : rows
thisRow = r(row, :);
thisRow(thisRow <= priorRowMin) = [];
if ~isempty(thisRow)
thisMin(row) = min(thisRow);
priorRowMin = thisMin(row);
end
end
thisMin
In the command window:
thisMin =
5.39
18.68
33.84
38.91
42.2
45.12
Best Answer