Fixed preprocess function for Matlab 2013