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

    function m = makeXregmodel(cif, class)
%MAKEXREGMODEL Construct a model from a CONINPUTFACTOR.
%
%  M = MAKEXREGMODEL(CIF, CLASS) is model (XREGMODEL) of the given class.
%  All of the inputs for the model, including the coding, is set-up from
%  the input factor (CIF) information.
%
%  See also CONINPUTFACTOR, XREGMODEL.

%  Copyright 2005-2007 The MathWorks, Inc. and Ford Global Technologies, Inc.

nf = length( cif );

% Create the model
m = feval( class, 'nfactors', nf );

% Set coding
src = [getMin( cif ); getMax( cif )].';
tgt = repmat( recommendedTgt( xregmodel('nfactors', 1) ), nf, 1 );
m = setcode( m, src, [], tgt );

% Set the factor info
xi = xinfo( m );
xi.Names   = cif.Name.';
xi.Units   = cif.Unit.';
xi.Symbols = cif.Symbol.';
m = xinfo( m, xi );

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