Matlab Dataprocessing Function