MATLAB: How to delete the branches

matrixsegment lines

111.png
I have a matrix which just consist by 0 and 1, like the figure above (1 is black and 0 is white). It's kind of river, but there is some noise like the red arrows above.
Is there some ways to identify these small segment lines and delete these small segment lines?
Calculating the length (pixel) of these small segment lines is not necessary, but I am interested to know it.
Any suggestion will be appreciated.

Best Answer

Maybe I can delete these segment lines in ArcGIS as the small segment lines can be identified as short length.