www.gusucode.com > mbcmodels 工具箱 matlab 源码程序 > mbcmodels/@xregtransient/getmodellist.m

    function [list,f] = getmodellist(U,nf)
%GETMODELLIST Get list of registered models with nf factors.
%
% [LIST, IDX] = GETMODELLIST(M, NF)

%  Copyright 2000-2014 The MathWorks, Inc. and Ford Global Technologies, Inc.


cfg = getpref(mbcprefs('mbc'),'dynamic');

n = length(cfg.models);
isok = true(n,1);
CheckNFact = nargin>1;

for i = 1:n
    try
        m = funcinit(U,cfg.models{i},true);
    catch
        isok(i) = false;
    end
    if isok(i) && CheckNFact
        isok(i) = (nf==nfactors(m));
    end    
end

list = cfg.models(isok);
f = [];
if ~isempty(list)
    f = find(strcmp(name(U),list));
    if isempty(f);
        f = 1;
    end
end