Hello,
In the code below, I am attempting to find the index of first zero searching from the left first column first row, going down the column, then find the index of first zero from last column last row searching up (as shown in the arrows below)?
In the picture above, rstart = 1, cstart = 1, rstop = 10, cstop = 20.
How do I go about accomplishing this task.
This is what I have so far:
n = 10;m = 20;M = randi([0 1], n,m);for i = 1:1:n for j = 1:1:m if M(i,j) == 0 rstart = i; cstart = j; break end endendfor ii = n:-1:1 for jj = m:-1:1 if M(ii,jj) == 0 rstop = ii; cstop = jj; break end endend
Best Answer