Suppose that you've run some function foo() in MATLAB and it complains that another function bar() is not found. You immediately realize that a directory with bar() is not in path and add this directory. Oops, stop on error flag is set, so we are in debug mode. Leave that mode by pressing Shift+F5 and re-run foo().
Surprisingly, you will see the same error message again! The reason is that your path changes were applied in temporary workspace of the debugger. So, by leaving debug and moving back to the original workspace you have reverted all path changes. Long story short, always double-check which environment you are in before applying any changes.