Sometimes you create MATLAB functions that take ages to run (more than 10 minutes). You want to be able to pause every now and then, by clicking a "CTRL+P" or something like that, make sure all the values are ok, and then continue running from the same spot. If you tried "CTRL+C", you know it's not working well. So, untill such an option will exist, I wrote a simple example to show how you can use a PushButton and a guarded breakpoint to do so.
Run the file, by executing "myFunc(1)".
You will see a button pop up. Every time you press it, it will halt the function's execution and allow you to view the progress of the code.
Pressing F5 will continue the run.
You can use this as a template for your specific needs, simply modify and use.