This occurs with large data sets, infinite loops, or slowly-converging optimizations.
The first option is to use CRTL+C to interrupt MATLAB. This sometimes will point to the problem, because MATLAB will display an error in the Command Window telling what was interrupted. If you have a counter running or something similar, look at its value in the Workspace window to see what the problem may be.
