www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgexprgroup/private/pGetEvaluationIndices.m

    function EvalInd = pGetEvaluationIndices(inputList, idx)
%PGETEVALUATIONINDICES Get the required evaluation indices for given outputs
%
%  EVALIND = PGETEVALUATIONINDICES(INPUTLIST, IDX) returns a cell array the
%  same length as IDX, with each cell containing the indices in the
%  expression group that need to be evaluated in order to obtain the result
%  for the expression at the corresponding IDX value.  INPUTLIST is a cell
%  array that contains the inputs needed for each item in the expression
%  group.

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


EvalInd = cell(size(idx));
for n = 1:numel(EvalInd)
    ReqInd = idx(n);
    NumFound = 0;
    while (NumFound~=length(ReqInd))
       NumFound = length(ReqInd);
       ReqInd = [inputList{ReqInd}, idx(n)];
    end
    EvalInd{n} = unique(ReqInd);
end