However, you need to define your own function, and never copy and paste directly.
At least, you don't need to understand every detail about this script by Seislab, because this is their function. You just need to understand the meaning of the function , what is input and what is output. Sorry but I am not an expert on your field, so I cannot help you so much, maybe you can test this script based on your data and erase any error by yourself. Anyway, first just try to run this script and test your data processing. Even, you can write the script by yourself if you can. Because Matlab is very simple to understand and not very hard to learn, maybe.