Community Profile

photo

Omar


Last seen: 4 years ago

Followers: 0   Following: 0

Message

Hi Everyone,

Can some matlab guru help me with this problem.

I have a huge set of data and I want to get rid of the zeros.
Such that when ever there are four or more than four consecutive zeros then remove them. But if less than four consecutive zeros then keep the data as it is.

e.g. if
A = [1 2 0 4 3 2 0 0 0 0 0 2 3 4 0]
the code should return
ans = [1 2 0 4 3 2 2 3 4 0]

Thanks,
Omar

Feeds

No Activity