Organize several figures using tabs or docked figure
162 views (last 30 days)
Show older comments
I am looking for a way to organize several figures within two tabbed or docked figures. I have two functions, func1 and func2, which are each called several times (~20x) within a script. A figure with a simple plot(x,y) is generated for each run of each function, i.e. 20 figures from func1 and 20 figures from func2. I would like to consolidate these 40 figures into just two figures, one for each function. Currently, the figures are generated and visibility is set on within the functions, but I can easily pass the handles into the main workspace as outputs if required.
I haven't had much success with the uitabgroup, but would be open to suggestions. I've also tried using the docking feature (shown below) but have not been able to generate two individual docked figures.. I end up with a docked-figure containing Figures 1, 2, and 4, while Figure 3 is a "free" window. Any information on how to generate a docked figure which isn't docked to the main Matlab window is also welcomed!
set(0,'DefaultFigureWindowStyle','normal');
h1 = figure;
h2 = figure;
set(h1,'WindowStyle','docked');
set(h2,'WindowStyle','docked');
set(0,'DefaultFigureWindowStyle','normal')
h3 = figure;
h4 = figure;
set(h4,'WindowStyle','docked');
1 Comment
Aaron Corcoran
on 1 Nov 2019
Hi Kristin,
before this line: set(h4, 'WindowStyle', 'docked');
put this line: set(h3, 'WindowStyle', 'docked');
I hope this helps!
Answers (1)
Sean de Wolski
on 6 Jul 2015
You just need to add tabs to the tab group. Here is an example not changing any titles/labels/sizes etc.
tg = uitabgroup; % tabgroup
for ii = 1:20
thistab = uitab(tg); % build iith tab
axes('Parent',thistab); % somewhere to plot
plot(rand(1,100));
end
3 Comments
See Also
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!