Delete leading and trailing blanks, and then merge consecutive blanks into one.
Published with MATLAB® R2014a