setFigDockGroup sets a figure's (or list of figures') docking group container, enabling to dock figures to containers other than the default 'Figures' container (for example, to the 'Editor' group as shown in the screenshot, or to any new user-defined group, or even to another figure's button).
Syntax:
hGroup = setFigDockGroup(hFig, group)
hButton = setFigDockGroup(hFig, hButton)
Inputs:
hFig is an optional handle or list of handles. These are normally figure handles, but not necessarily: the handles' containing figures are automatically inferred and used. If hFig is not supplied, then the current figure handle (gcf) is assumed.
group is either a group name (e.g., 'Editor', 'Figures', 'my group') or a group handle returned from a previous setFigDockGroup function call.
hButton is the handle of a uicontrol pushbutton on another figure. This button would typically be labeled "undock" or have an undocking icon. Note that the docked figure will be minimized to the target hButton - you will NOT be able to see the docked figure's contents in the target figure, only to undock it via the button. Docking into a figure panel will perhaps be added in some future version.
Outputs:
The returned hGroupContainer object allows access to many useful properties and callbacks. Type "get(hGroupContainer)" to see the full list. Note that hGroupContainer may return empty ([]) if the group container is not visible.
See extended help within.
Warning:
This code heavily relies on undocumented and unsupported Matlab functionality. It works on Matlab 7.4+, but use at your own risk!
This utility does NOT work with uifigures (created using the uifigure function or App Designer) - only with legacy (Java-based) figures.
Bugs and suggestions:
Please send to Yair Altman (altmany at gmail dot com)
Cite As
Yair Altman (2024). setFigDockGroup (https://www.mathworks.com/matlabcentral/fileexchange/16650-setfigdockgroup), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Acknowledgements
Inspired: DOCK and UNDOCK figures into groups
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.5.0.0 | Fixes for recent Matlab releases, up to R2020b |
|
|
1.4.0.0 | Removed annoying warnings about possible future features removal (yes, we know...) |
||
1.3.0.0 | Fixes for Macs |
||
1.2.0.0 | Fix for R2011a |
||
1.1.0.0 | Enabled docking to a figure button (minimized), and undocking back from that figure button. |
||
1.0.0.0 |