This does not require a for-loop. In fact, the last line is the solution. The first few lines just creates an example matrix where rows 3 and 13 are all below 10.
% Create a 15x7 matrix of random integers 1:20
m = randi(20,15,7);
% Rows 3 and 13 are all below 10 (maybe others, too)
m([3,13],:) = m([3,13],:)-11;
%find the first row where all the columns have a value below 10.
rowNumber = find(all(m < 10,2),1);
% find the first row AFTER ROW N where all columns are < 10
Best Answer