Batch correction function and example

Note that the py-file and the m-file need to be changed simultaneously.