www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgfuncexpr/charlist.m

    function str = charlist(f,doFull)
%CHARLIST  expression equation as string
%   str = charlist(v)
%   str = charlist(v,doFull)
%   The equation is terminated at features if doFull is false. The default for doFull is false.

%  Copyright 2000-2012 The MathWorks, Inc. and Ford Global Technologies, Inc.

if nargin<2
    doFull=false;
end

if isempty(f)
    str = '';
else
    inputs = getinputs(f);
    isSource = parrayeval(inputs,@issource,{},@false);

    names = pveceval(inputs, @(e) charlist(e,doFull));
    for i=1:length(names)
        if ~isSource(i) || (~doFull && isa(inputs(i).info,'cgfeature'))
            % add brackets to non source (features when ~doFull are treated as source)
            names{i} = sprintf('(%s)',names{i});
        end
    end
    % substitute equation
    str = subs(f.function,names);
end