matthiasm@8: function fignum = subplot3(nrows, ncols, fignumBase, plotnumBase) matthiasm@8: % function subplot3(nrows, ncols, fignumBase, plotnumBase) matthiasm@8: % Choose a subplot number, opening a new figure if necessary matthiasm@8: % eg nrows=2, ncols = 2, we plot on (fignum, plotnum) = (1,1), (1,2), (1,3), (1,4), (2,1), ... matthiasm@8: matthiasm@8: nplotsPerFig = nrows*ncols; matthiasm@8: fignum = fignumBase + div(plotnumBase-1, nplotsPerFig); matthiasm@8: plotnum = wrap(plotnumBase, nplotsPerFig); matthiasm@8: figure(fignum); matthiasm@8: if plotnum==1, clf; end matthiasm@8: subplot(nrows, ncols, plotnum); matthiasm@8: matthiasm@8: