Fix text file parsing for MATLAB