Last active
December 12, 2017 04:53
-
-
Save kevin-d-omara/0b41a5d2895e0f0535ff39e700d3f7cf to your computer and use it in GitHub Desktop.
Create subplots dynamically, great for prototyping.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function makePlot = MakeAutoSubplot(numRows, numCols) | |
% Creates a new subplot each time 'makePlot()' is called. Subplots are | |
% arranged in a numRows-by-numCols grid. See Matlab documentation on | |
% subplot for details. | |
% | |
% Uses a closure of 'numRows' & 'numCols' to take care of bookeeping. | |
% | |
% Return: | |
% makePlot - function pointer; calling it creates the next subplot | |
% | |
% Parameters: | |
% numRows - number of subplot rows | |
% numCols - number of subplot column | |
i = 1; | |
function g() | |
subplot(numRows, numCols, i); | |
i = i + 1; | |
end | |
makePlot = @g; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment