Why do figure windows disappear behind the MATLAB window in R14SP3 on a Mac OS X?

23 views (last 30 days)
When I create figures, and then modify them from the MATLAB Command line, they go into the background behind the MATLAB Window. When I try and retrieve them, by double clicking the X11 icon, they do not come to the front. Only the X11 terminal window does.
The only way to bring the figures to the front is to use the Window menu on on the MATLAB Desktop or the FIGURE function.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
MATLAB 7.1 (R14SP3), no longer creates X11 figure windows. Instead it creates Java figure windows, which means they are no longer in the X11 window layer. Thus bringing all the X11 windows to the front will not bring these figure windows to the front.
Running MATLAB with the –nojvm option, the figures are created as X11 windows. So you can bring them to the front, as you had experienced previously, by double clicking the X11 icon in the Dock.
Using the Window menu on the MATLAB Desktop to bring the figure windows to the front is not always desirable. You can also use the FIGURE function to bring a figure to the front by entering the following at the MATLAB Command Prompt:
figure(gcf)
In this case, it brings the current figure to the front, but you can use any available figure handle in place of “gcf”.
The following is a workaround for a graphical way to bring all of the open figures to the front.
1. Ensure the ShortcutsToolbar on the MATLAB Desktop is visible. If not, select "Desktop -> Shortcuts Toolbar" from the MATLAB menu bar.
2. Ctrl-Click the Shortcuts Toolbar to bring up its context menu.
3. Select New Shortcut
4. In the Label edit box, enter the title of the shortcut. For example:
Show all figures
5. Add the following code to the Callback field:
all_figure_handles = findall(0, 'type', 'figure');
for iCount = length(all_figure_handles):-1:1
figure(all_figure_handles(iCount))
end
clear all_figure_handles icount
6. Click Save
Now if you click on the Shortcut you just created, it will bring all of the available figures to the front. The above code searches the MATLAB root window for any associated handles that point to a figure. It then loops through the handles, bringing them to the front using the FIGURE function. Note that in order to preserve the figure order on the screen, it loops through the array of handles in reverse order. Finally it removes the array of figure handles and counting variable from memory using the CLEAR function.
Note that the FINDALL function will include figures with hidden handles, so it will bring any open GUIs to the front as well.

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!