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

    function [str, reconData] = charForSummary(obj,DS)
%CHARFORSUMMARY Template string for constraint summary
%
%   [STR, INPUTNAMES] = CHARFORSUMMARY(OBJ) produces a template string and
%   input name store for use in the constraint summary view in CAGE. 
%
%   DS is a cgstaticdataset object if the constraint is evaluated over a
%   dataset. Otherwise it is empty.
%
%   STR is created by calling CHAR(OBJ) and replacing the inputs of OBJ
%   with the tokens CONSUMMARYINPUTi where i is the i-th input. 
%
%   RECONDATA provides data required to reconstruct the string from the
%   template in the constraint summary view. For this object, it is
%   returned as a cell array of input names.
%
%   See also CHAR

%   Copyright 2007-2009 The MathWorks, Inc.

if isStaticMode(obj)
    charForSummary_return = getStaticData(obj, 'charForSummary_return');
    str = charForSummary_return{1};
    reconData = charForSummary_return{2};
elseif nargin<2 || isempty(DS)
    % Get inputs and names
    pInp = getInputs(obj);
    inputNames = pveceval(pInp, @getname);

    % Temporarily rename the inputs
    pInp = getInputs(obj);
    nInp = length(pInp);
    tmpNames = cell(1, nInp);
    for i = 1:nInp
        tmpNames{i} = sprintf('CONSUMMARYINPUT%d', i);
    end
    passign(pInp, parrayeval(pInp, @setname, {tmpNames}));

    % Generate template string
    str = char(obj);

    % Reset names
    passign(pInp, parrayeval(pInp, @setname, {inputNames}));

    % Data required to reconstruct the string in the constraint summary view is
    % the input names
    reconData = inputNames;
else
    % data set
    str = char(obj);
    reconData = '';
end