www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@model/getAlternativeTypes.m

    function list = getAlternativeTypes(mdl)
%GETALTERNATIVETYPES get a list of alternative model types
% 
% list = GETALTERNATIVETYPES(MODEL);
%    You can create a new model of a given type with
%    MBCMODEL.MODEL.CREATEMODEL
%
% See also mbcmodel.model.CreateModel, mbcmodel/CreateModel

%   Copyright 2006-2007 The MathWorks, Inc.

m = mdl.Object;

% get list of models constructors (option 8 means expand linear models)
mc = ModelClasses(m,8);

nModels = length(mc.fCreate);
list = cell(1,nModels);
for i=1:nModels
    try
        % create xregmodel
        mnew = xregCreateModel(mc.fCreate{i},m);
        % copy base model info
        if isa(mnew,'localmod')
            list{i} = ['Local ',getType(mnew)];
        else
            list{i} = getType(mnew);
        end
    end
end

% remove empty models
OK = ~cellfun(@isempty,list);
list = list(OK);