matlab pre-processing pipeline