function h = subplotrc(varargin)

%SUBPLOTRC(m,n,r,c) -- put subplot in row r, column c of figure
%   
% h = subplotrc(varargin)
% subplotrc(m,n,r,c) put suplot in row r, column c of figure;
% all other forms passed through to subplot without alteration
%
% See also SUBPLOT, SUB2IND.

% Attributed to Andrew Diamond, adiamond@EnvisionSystemsLLC.com
% Downloaded from Matlab Central File Exchange on $Date: 2006/06/06 $

if (length(varargin)==4 && all(cellfun(@isnumeric,varargin)))
    p = sub2ind([varargin{2},varargin{1}],varargin{4},varargin{3}) ;
    h = subplot(varargin{1},varargin{2},p) ;
else  % pass through to SUBPLOT
    h = subplot(varargin{:}) ;
end

if (nargout==0)
    clear h ;
end

%%%%% End of file SUBPLOTRC.M
