File Exchange

image thumbnail

"Smart"/Silent Figure

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

3 Downloads

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.

Comments and Ratings (17)

Eric Garner

Works like a charm!

Yenson Lau

Works also in Ubuntu 13.10.

Thanks!

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:

set(0,'DefaultFigureWindowStyle','docked')

Excellent! works at first ;)

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;
end

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

Helpful.

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.

Eg.
set(0,'currentFigure',figureHandle)
set(figureHandle,'currentAxes',axesHandle)

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.
Thanks!

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