% SUBPLOTT - calculate which plot number for subplot
% h = subplott(nrows, ncols, thisRow, thisCol, varargin)
%
% e.g. to have a 5x4 subplot, and this plot to be at 3,2 do:
% subplott(5,4,3,2);

function theAxis = subplott(nrows, ncols, thisRow, thisCol, varargin)

thisPlot = (thisRow - 1) * ncols + thisCol;
if isempty(varargin)
   ax = subplot(nrows,ncols,thisPlot);
else
   ax = subplot(nrows,ncols,thisPlot,varargin);
end	

if nargout>0
   theAxis = ax;
end
