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