This must be asked before, but I cannot find it now. It calculates the number of zeros, adds the number of zeros to the vector, then calculates the number of units, adds the number of units to the vector, and so on. If the value is zero, make it equal to zero.
Is there some kind of null command for this count in Matlab?
Login ---> Exit
0 1 1 1 2 3 3 4 7 ---> [1,3,1,2,1,0,0,1]
0 1 1 1 ---> 1 3
2 7 ----> 0 0 1 0 0 0 0 1
source
share