Data chopping algorithms for MATLAB