www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@coninputfactor/size.m

    function varargout = size(cif, dim)
%SIZE Size of a constraint input factor object
%
%  VARARGOUT = SIZE(CIF, DIM)
%
%  D = SIZE(CIF) returns [1, NF].
%  [M, N] = SIZE(CIF) returns M = 1 and N = NF.
%  [M1, M2, M3,..., MN] = SIZE(CIF) returns M1 = 1, M2 = NF, and M3, ..., MN = 1.
%  M = SIZE(CIF, DIM) returns M = NF if DIM = 2 and 1 otherwise.
%
%  NF is the number of input factors.
%
%  See also CONBASE, CONINPUTFACTOR, SIZE, CONINPUTFACTOR/SIZE.

%  Copyright 2004-2005 The MathWorks, Inc.

NF = length( cif );

% There must be at least one output argument
nout = max( nargout, 1 );

if nargin == 1,
    if nout == 1,
        %  D = SIZE(CIF)
        varargout{1} = [1, NF];
    else
        %  [M1, M2, M3,..., MN] = SIZE(CIF)
        [varargout{1:nout}] = deal( 1 );
        varargout{2} = NF;
    end
else
    %  M = SIZE(CIF, DIM)
    if dim == 2,
        varargout{1} = NF;
    else
        varargout{1} = 1;
    end
end

%------------------------------------------------------------------------------|
% EOF
%------------------------------------------------------------------------------|