about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/subplot3.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/KPMtools/subplot3.m')
-rw-r--r--sourcecodes/bnt-master/KPMtools/subplot3.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMtools/subplot3.m b/sourcecodes/bnt-master/KPMtools/subplot3.m
new file mode 100644
index 00000000..0f8d1cc3
--- /dev/null
+++ b/sourcecodes/bnt-master/KPMtools/subplot3.m
@@ -0,0 +1,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);
+
+