Displaying 1 result from an estimated 1 matches for "countzerosbeforeon".
Did you mean:
countzerosbeforeones
2006 Nov 28
5
Counting zeros in a matrix
Hi All,
If you could help me with this problem I would greatly appreciate it.
Suppose I have a matrix A:
1 1 1 1 0 1 1 1 1
1 1 1 0 1 0 1 0 0
1 0 1 0 0 1 0 0 0
1 1 0 0 0 0 1 0 0
I would like, for each row, to sum the number of times a 0 appears in
front of a 1. So what I would like is to have
Sum
1 1 1 1 0 1 1 1 1 1
1 1 1 0 1 0 1 0 0 2
1 0 1 0 0 1 0 0 0 2
1 1 0 0 0 0 1