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

    function [Lengths, pVal] = getvaluedatasizes(optim, pVal)
%GETVALUEDATASIZES Return the length of the data in each input value
%
%  [LENGTHS, PVAL] = GETVALUEDATASIZES(OPTIM) returns the lengths of all of
%  the inputs that are required for the optimization.
%
%  [LENGTHS, PVAL] = GETVALUEDATASIZES(OPTIM, PVAL) returns the lengths of
%  the data for the specified inputs.

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


if nargin<2
    % Gather all required inputs from the objectives and constraints
    ObjInputs = mbccellarrayeval(getObjectiveFunc(optim), @getInputs);
    ConInputs = mbccellarrayeval(getEnabledConstraints(optim), @getInputs);
    pVal = unique([ObjInputs{:}, ConInputs{:}, optim.values]);
end

Lengths = pGetValueSizes(optim, pVal);