Hello! I have a dataset that occasionally has runs of zeros. I would like to delete those runs from my data. How do I state that for any run of 3 or more zeros in my data, I would like Matlab to completely delete those observations from my dataset.

So for example, I have a dataset that looks like

[1 5;2 7;3 0;4 0;5 0;6 3]

I would like the that run of zeros deleted so that my new dataset looks like…

[1 5;2 7;6 3]

Any help is greatly appreciated!!

## Best Answer