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

    function str = charlist(obj,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(obj)
    str = '';
else
    inputs = getinputs(obj);
    if length(inputs)==1
        str = getname(obj);
    else
        InputArgs = pveceval(inputs,@(e) charlist(e,doFull));
        for ind=2:length(inputs)
            InputArgs{ind} = sprintf('CASE %d: %s',ind-1,InputArgs{ind});
        end
        str = sprintf('(SWITCH %s %s)',InputArgs{1},strjoin(InputArgs(2:end),', '));
    end
end