I am trying to obtain logical output by finding the entries which are 0 but with a condition that its previous entry must not be zero. I'd like to avoid using FOR loop since the size of the input matrix is quite large. But I just couldn't figure out how to avoid using FOR loop.
Here is the example of my input and desired output.
input = [6 6 5 3 0 0 2 0 3 1 0 0 0 4 0; 3 5 1 4 2 0 0 0 9 0 8 7 0 0 2] output = [0 0 0 0 1 0 0 1 0 0 1 0 0 0 1; 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0]
Any suggestions would be really appreciated.
Best Answer