This should be relatively easy.
Given a binary matrix, i want to start counting up (starting at 1) at the first zero until the last zero. Then i want to continue counting from the top row at the first 1. Like so:
[0 1 0;1 1 0;0 0 1] becomes [1 6 2;7 8 3; 4 5 9]
Prefereably with an If and/or for statement, but im open to solutions.
Best Answer