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

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

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


CheckNFact = nargin>1;

cfg = getpref(mbcprefs('mbc'),'usermodels');
n = length(cfg.models);
isok = false(n,1);
for i=1:n
    % make the models
    try
        m = funcinit(U,cfg.models{i});
        isok(i) = true;
    end
    if isok(i) && CheckNFact
        isok(i) = (nfactors(m)==nf);
    end
end

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