SquareSubplot - Layout subplots in a square arrangement. USAGE p = SquareSubplot(n,i) n total number of subplots i current subplot
0001 function p = SquareSubplot(n,i) 0002 0003 %SquareSubplot - Layout subplots in a square arrangement. 0004 % 0005 % 0006 % USAGE 0007 % 0008 % p = SquareSubplot(n,i) 0009 % 0010 % n total number of subplots 0011 % i current subplot 0012 0013 % Copyright (C) 2008-2011 by Michaƫl Zugaro 0014 % 0015 % This program is free software; you can redistribute it and/or modify 0016 % it under the terms of the GNU General Public License as published by 0017 % the Free Software Foundation; either version 3 of the License, or 0018 % (at your option) any later version. 0019 0020 if nargin < 2, 0021 error('Incorrect number of parameters (type ''help <a href="matlab:help SquareSubplot">SquareSubplot</a>'' for details).'); 0022 end 0023 0024 M = round(sqrt(n)); 0025 N = ceil(n/M); 0026 p = subplot(M,N,i);