File Exchange

## subfigure(nRows,nCo​ls,figureId,varargi​n)

version 1.0.0.0 (1.83 KB) by
Create figure in tiled positions

Updated 18 Nov 2015

SUBFIGURE Create figure in tiled positions.
1) subfigure(m,n,p) move gcf to the position specified by m,n,p in a same
manner as subplot(m,n,p) does, p is a scalar or vector.
2) subfigure(m,n,p,figure) create a new figure at the specified position.
3) subfigure(m,n,p,f) when f is a figure will move f to the specified position.
4) subfigure(...,P1,V1,P2,V2...) sets the specified property-value pairs on the figure.
OUT: hFig - Handle of figure.
!! NOTE1: 'maximize' function is required!
http://mathworks.com/matlabcentral/fileexchange/25471-maximize
NOTE2: you may add extra line to 'maximize' function:
warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
in order to get rid of warning message.
Enjoy!

### Cite As

Nikolay (2021). subfigure(nRows,nCols,figureId,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/53225-subfigure-nrows-ncols-figureid-varargin), MATLAB Central File Exchange. Retrieved .

Nikolay

for those who feels ok to use global variables - you may consider a small improvement by the replacement:

maximize(hFig)
pause(0.1)
s=get(hFig,'outerposition');

with

global fullscreensize
if isempty(fullscreensize)
maximize(hFig)
pause(0.1)
fullscreensize=get(hFig,'outerposition');
end
s=fullscreensize;

Nikolay

Here is a dummy code for the cover picture. try it:

N=6;
color=lines(N);
for k=1:N-1
m=2^floor(k/2);
n=2^ceil(k/2);
p=2^k-2^(k/2*(1-rem(k,2)));

str=sprintf('subfigure(%g,%g,%g)',m,n,p);
uicontrol('style','text','string',str,'fontsize',22,'units','normalized','position',[0 0.4 1 0.2],'backgroundcolor',color(k,:))
end

str=sprintf('subfigure(%g,%g,%g)',m,n,2^k);
uicontrol('style','text','string',str,'fontsize',22,'units','normalized','position',[0 0.4 1 0.2],'backgroundcolor',color(N,:))

##### MATLAB Release Compatibility
Created with R2014b
Compatible with any release
##### Platform Compatibility
Windows macOS Linux