for ii = 1:length(readings) if readings(ii) > 100 break; endendfprintf('First reading above 100 is at index %d.\n', ii);
MATLAB: Hi everyone, I have been trying to debug this for loop as it always retain the last value of the array even if none of the conditions meet for every element. For instance, using readings = [1 20 55 90], it will print that reading(4)>100.
breakfor loop
Best Answer