File Exchange

image thumbnail

"Smart"/Silent Figure

version (302 Bytes) by Daniel Eaton
Create or switch to a figure without it stealing focus from other windows.


Updated 03 Nov 2005

No License

In Windows, MATLAB R14's FIGURE behaviour can be annoying. Namely, whenever we invoke figure/figure(X), it immediately jumps to the foreground, and steals focus from whatever other window was active, preventing you from switching to other processes, the MATLAB editor window, etc... (if you are repeatedly switching between figures/displaying results in a loop). This wrapper to figure makes FIGURE silent -- ie. if you had figure X in the background, then the call figure(X) will keep that figure in the background.

Cite As

Daniel Eaton (2021). "Smart"/Silent Figure (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (17)

Eric Garner

Works like a charm!

Dale Roberts

Yenson Lau

Etienne Payen

Eric Sampson

José Goulart

Works also in Ubuntu 13.10.


Boyan Bonev

Good job. Alternatively you can just force all the figure windows to show up docked in Matlab's GUI. This won't still the focus and is very useful for easily switching from one figure to the other with Ctrl+Pg.Up/Pg.Down (or by clicking the tabs). I actually prefer it. Use this before opening any figure:


ismael Gutierrez

Excellent! works at first ;)

Dominic Barone

You can make it more like figure() by using varargout. This way you can avoid having to put a semi-colon at the end.

Change the function call to:
function varargout = sfigure(h)

And add this to the end:
if nargout == 1
varargout{1} = h;

Sorin Z

Sorin Z

Very very useful for Mac OSX!! Thanks.

Adrian G

Works perfectly. Thanks!

Curtis I

Hah! This is awesome. Thanks!

Brian Armstrong


It would be nice to be able to separately control whether the figure come to the top and whether it steals the focus. Especially
in X windows.

Matt Hilt

You can quiet the axes by first setting the current figure as is done by this function, then setting the current axes in that figure.


Jean-Yves Tinevez

Usefull !
Is there a way to tweak the "axes" command in the same way ? So that one can update an existing figure without stealing the focus...

Stephen Hole

Very useful.

MATLAB Release Compatibility
Created with R14SP1
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!