about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/subplot3.m
blob: 0f8d1cc3470b2de56c1770b5f5b2c4014343f2ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
function fignum = subplot3(nrows, ncols, fignumBase, plotnumBase)
% function subplot3(nrows, ncols, fignumBase, plotnumBase)
% Choose a subplot number, opening a new figure if necessary
% eg nrows=2, ncols = 2, we plot on (fignum, plotnum) = (1,1), (1,2), (1,3), (1,4), (2,1), ...

nplotsPerFig = nrows*ncols;
fignum = fignumBase + div(plotnumBase-1, nplotsPerFig);
plotnum = wrap(plotnumBase, nplotsPerFig);
figure(fignum);
if plotnum==1, clf; end
subplot(nrows, ncols, plotnum);