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

    function cif = cat(dim, varargin)
%CAT Concatenate constraint input factors
%
%  CAT(DIM, A, B) concatenates the constraint input factor objects A and B along
%  the dimension DIM.
%
%  CAT(2, A, B) is the same as [A, B].
%  CAT(1, A, B) is the same as [A; B]. However, because constraint input factors
%  behave as row vectors, this will cause an error.
%
%  CAT(DIM, A1, A2, A3, A4, ...) concatenates the constraint input factor
%  objects A1, A2, etc., along the dimension DIM. This will cause an error if
%  DIM is not 2.
%
%  See also CONBASE, CONINPUTFACTOR, CONINPUTFACTOR/HORZCAT,
%      CONINPUTFACTOR/VERTCAT, CAT. 

%  Copyright 2004-2008 The MathWorks, Inc.

% Check input arguments
if dim ~= 2,
    error(message('mbc:coninputfactor:InvalidArguments'));
end
if ~all( cellfun( 'isclass', varargin, 'coninputfactor' ) ),
    error(message('mbc:coninputfactor:InvalidArguments1'));
end

% Concatenate
cif = varargin{1};
for i = 2:length( varargin ),
    cif.Name   = [cif.Name,   varargin{i}.Name];
    cif.Symbol = [cif.Symbol, varargin{i}.Symbol];
    cif.Unit   = [cif.Unit,   varargin{i}.Unit];
    cif.Min    = [cif.Min,    varargin{i}.Min];
    cif.Max    = [cif.Max,    varargin{i}.Max];
end

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