I guess, that Matlab does exactly what it is expected to do.
If h(a)*h(b)>0 is false, Matlab enters the else branch. Although you set the value of the edit1 field there, the display is not updated, because there is no drawnow command. If you have an infinite loop, it looks like Matlab does nothing, but in is running correctly.
Consider Rik's valuable advice: Use the debugger to step trough the code line by line.