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