given: a signal as a time series
return: discrete number of times is is holds a nonzero position
For example:given: [0,1,0.5,0.7,0,1]return: 2given: [0,1,0,0,0,.3,1,0,0,1]return: 3given: [0,1]return: 1
is there a way to do this task in a vector manner as opposed to a for loop that counts nonzero periods as it encounters them and flicks a counter.
Best Answer