For backward compatibility considerations, I hope that uisuspend and uirestore would not be discontinued but rather be modified to simply call uiwait and uiresume. Hopefully, in a nearby Matlab release these inconsistencies between the two function sets will disappear and they will be merged, because the current situation is prone to errors and confusion.
DISABLE SECTION MODE MATLAB R2013A CODE
It is important not to confuse between these two function sets, and most importantly, not to confuse between uiresume and uirestore after using their counterparts earlier in the code – odd things might happen if you do… To complicate things, the fully-documented and supported uiwait and uiresume functions have the semi-documented unsupported built-in counterparts uisuspend and uirestore, which are very similar in functionality and name. In short, this is not a trivial exercise at all. And once we uiresume from the lock, we need to remember each handle’s pre- uiwait state, so that if it was disabled before the call to uiwait, it will remain so after uiresume. We also need to take care to disable hidden handles, toolbars, menu-bars, context-menus, Java components – all these have different ways of being accessed and disabled. But this is tedious, lengthy, and in complex GUIs that have multiple layers of nested panels, it also requires careful recursive programming. Of course, we could always loop over all the relevant GUI handles and set their Enable property to ‘inactive’ or ‘off’. You can set the figure’s WindowStyle property to ‘modal’ but this is not the same: (1) it removes the toolbar and menu-bar (2) it still enables interaction with all the figure’s GUI controls and (3) it prevents access to any other Matlab window or desktop until the modal figure is closed. Matlab does not have any documented way to disable an entire figure window.
DISABLE SECTION MODE MATLAB R2013A WINDOWS
In more complex situations we may wish to suspend interaction on certain figure windows while continuing to process Matlab functionality – this is impossible to do using uiwait. This is great for simple cases where we require a user to respond to a popup window (e.g., message-box or input dialog) before being allowed to proceed. Unfortunately, the side effect is that uiwait blocks the regular (non-callback’ed) processing until the lock is released. % Close the figure (use try-catch in case f is already closed) H = uicontrol('Position',, 'String', 'Continue', 'Callback', 'uiresume(gcbf)') ĭisp('This will print after you click Continue or close the window') % Close the figure (use try-catch in case f is already closed) try close (f ) catch, end H = uicontrol ( 'Position',, 'String', 'Continue', 'Callback', 'uiresume(gcbf)' ) ĭisp ( 'This will print after you click Continue or close the window' )