www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgoptim/getPrimaryExpression.m

    function p = getPrimaryExpression(opt)
%GETPRIMARYEXPRESSION primary expression/model for optimization
%    p = getPrimaryExpression(opt);
%    The primary expression is the model in the first objective.

%  Copyright 2009 The MathWorks, Inc. and Ford Global Technologies, Inc.

p = xregpointer;
Obj = getObjectiveFunc(opt);
if ~isempty(Obj)
    pDep = getDependentPtrs(Obj{1});
    if ~isempty(pDep)
        ind = find(parrayeval(pDep,@(M) isa(M,'cgmodexpr'),{},@false));
        if ~isempty(ind)
            p = pDep(ind(1));
        end
    end
end