Code covered by the BSD License  

Highlights from
Manage and Dock Figures into Group

5.0

5.0 | 3 ratings Rate this file 29 Downloads (last 30 days) File Size: 3.87 KB File ID: #18106
image thumbnail

Manage and Dock Figures into Group

by

 

23 Dec 2007 (Updated )

SETFIGDOCKED docks figures at specified positions in group of figures

| Watch this File

File Information
Description

group = setfigdocked('PropertyName1',value1,'PropertyName2',value2,...)
  PropertyName:
      - GroupName name of group need to be generated
      - GridSize scalar or vector quantity, defines number of rows
                    and columns of cell in group
      - SpanCell vector or matrix quantity, size n x 4,
                    [row col occupiedrows occupiedcols]
                    build an cell at the position (row, col) in group
                    cell (GridSize) which occupies "occupiedrows"
                    rows and "occupiedcols" columns
      - Figure handle of figure
      - Figindex index position of figure in group cell
      - Maximize 0/1, maximize group
      - GroupDocked 0/1, dock group

Example:
         group = setfigdocked('GroupName','Image and Edges','GridSize',3,'SpanCell',[1 2 2 2]);
         im1 = imread('cameraman.tif');
         figure;imshow(im1);set(gcf,'Name','Cameraman','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',2);
 
         figure; edge(im1,'prewitt');set(gcf,'Name','Prewitt method','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',1);
 
         figure; edge(im1,'roberts');set(gcf,'Name','Roberts method','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',3);

         figure; edge(im1,'roberts');set(gcf,'Name','Roberts method','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',4);

         figure; edge(im1,'roberts');set(gcf,'Name','Roberts method','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',5);

         figure; edge(im1,'canny');set(gcf,'Name','Canny Method','NumberTitle','off')
         group = setfigdocked('GroupName','Image and Edges','Figure',gcf,'Figindex',6);

         group = setfigdocked('GroupName','Image and Edges','Maximize',1,'GroupDocked',0);

Acknowledgements

Find J Obj Find Java Handles Of Matlab Graphic Objects inspired this file.

This file inspired Dynamical Systems Toolbox.

MATLAB release MATLAB 7.1.0 (R14SP3)
Other requirements This function runs on MATLAB 7.1 sp3 or higher
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
11 Apr 2014 Thierry Dalon

If the figure was already docked in the Group it is not enough to select the destination tile to dock the figure to a selected position. Somehow the previous position is remembered.
As workaround reset the dock group of the figure to a hidden 'Temp' group to clear the memory of the position - before docking the figure.

25 Jun 2013 Pete

One important thing to note: This script relies on a bit of a hack where some key strokes are simulated to set focus on the dock.

If, earlier in your script, you have used something like Psychtoolbox's 'ListenChar' to intercept keystrokes, then setfigdocked will not function properly. Just a friendly warning! (5 hours of debugging, and several white hairs, later..)

Still a good function though!

19 Nov 2012 Pete

I was looking to make a GUI for a toolbox, involving multiple figure windows. This struck me as an elegant alternative to trying to manually keep multiple figures arranged.

Seems to work very nicely. (R2012b; Win7-64bit)

22 Jun 2012 Keith

This works fine when I run it from the command window, but when I try to run it from inside a GUI, I'm getting an error. Here's the trace:

Attempt to reference field of non-structure array.

Error in setfigdocked (line 169)
jpanel.requestFocus(true); % Focus on Dock

Error in particletracking>splittifbutton_Callback (line 790)
group = setfigdocked('GroupName','Images2','GridSize',[2 3], 'GroupDocked', 0);

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in particletracking (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in @(hObject,eventdata)particletracking('splittifbutton_Callback',hObject,eventdata,guidata(hObject))


Error while evaluating uicontrol Callback

14 Feb 2012 Yair Altman

take at look at the related utility setFigDockGroup - http://www.mathworks.com/matlabcentral/fileexchange/16650-setfigdockgroup

30 Nov 2010 Pirmin Borer

Really good tool. I also tried for a while how to set up groups with the DTgroup class, it takes a while to understand matlabs built-in java. So thanks very much!!!!

11 Feb 2009 Sebastian Hölz

SWEET !!!
Great job. I've been searching the Matlab Java Archives for the appropriate objects/methods/properties for (almost) years and just could not find them. The docking of figures into seperate containers is a great way to organize your work-flow, if you have lots of figures to work with at the same time and don't want to get lost. I'll highly recommend to look into this ...

Updates
14 Feb 2012

Fix errors which occur MATLAB v.2009 and later release

14 Feb 2012

Fix errors on Matlab v2009 and later releases

15 Feb 2012

Fixed error on Matlab 2011, and allow multiple figures docking in the same cell.

23 Jul 2012

fix error caused by empty jpanel

Contact us