www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@mdevproject/ImportList.m

    function pList=ImportList(MP,Type)
%IMPORTLIST list of models for import to CAGE
%
% pList=ImportList(MP,Type)

%  Copyright 2005-2016 The MathWorks, Inc.

pList= null(xregpointer,0,1);
switch lower(Type)

    case 'response'
        pList= children(MP,@children);
        pList= [pList{:}];
        pList= iValidatedModels(pList);

    case 'point-by-point'
        pTP= children(MP);
        if ~isempty(pTP)
            % find twostage testplans
            ns= pveceval(pTP,@numstages);
            ts= [ns{:}]==2;
            % get list of local nodes and point-by-point nodes
            pList= [pveceval(pTP(ts),@children,@children),...            
             {pveceval(pTP(ts),@(t) children(t,strcmp(children(t,@guid),'ptbypt')))}];
            
            if ~isempty(pList)
                pList= [pList{:}];
                if ~isempty(pList)
                    pList= [pList{:}];
                    supp= pveceval(pList,@MBsupport);
                    supp= [supp{:}];
                    sel= [supp.export];
                    pList= pList(sel);
                else
                    pList= null(xregpointer,0,1);
                end
            else
                pList= null(xregpointer,0,1);
            end
        end
    case 'datum'
        pList= children(MP,@children,@datumlink);
        pList= [pList{:}];
        if ~isempty(pList)
            pList= [pList{:}];
            pList= unique(pList(pList~=0));
            pList= iValidatedModels(pList);
        end
    case 'response feature'
        pTP= children(MP);
        if ~isempty(pTP)
            ns= pveceval(pTP,@numstages);
            ts= [ns{:}]==2;
            pLocal= pveceval(pTP(ts),@children,@children);
            pLocal= [pLocal{:}];
            if ~isempty(pLocal)
                pLocal= [pLocal{:}];
                pRF= pveceval(pLocal,@children);
                pRF= [pRF{:}];
                pList= iValidatedModels(pRF);
            end
        end
end
if isempty(pList) 
    % make the correct shaped pointer empty pointer is returned
    pList= mbcpointer(1,0);
end


function pList= iValidatedModels(pList)

if ~isempty(pList)
    hb= pveceval(pList,@hasBest);
    st= pveceval(pList,@status);
    pList= pList( [hb{:}] & [st{:}]);
end