File Exchange Pick of the Week

Our best user submissions

Default Docked Figures

I just wanted to pass along a small tip that you might find useful. If you’ve become as big of a fan of docked figures as I have, you might be looking for a way to have figures docked by default when they are created. This is easy to do (but not obvious) by modifying default figure properties. The following command will cause all subsequent new figures in the current MATLAB session to open docked:

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

Put this command in your startup.m file for this to be the default behavior for every MATLAB session.

Don’t like it?
This will set things back to normal.

set(0,'DefaultFigureWindowStyle','normal')

Want to understand how this command works?
This is the standard graphics set command. The first argument is the handle to the root graphics object, i.e. the screen. This applies to all subequently generated graphics objects. When a figure is docked, it’s WindowStyle property is set to ‘docked’. Since this is a Figure property, I can modify it’s default behavior by appending DefaultFigure to WindowStyle. Hence,

set(0,'DefaultFigureWindowStyle','docked')
|
  • print

Comments

To leave a comment, please click here to sign in to your MathWorks Account or create a new one.