www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgsubexpr/charlistshort.m
function str = charlistshort(d) %CHARLISTSHORT cgsubexpr charlist method % % STR = CHARLISTSHORT(OBJ) returns a recursive string describing this % expression. % Copyright 2000-2012 The MathWorks, Inc. and Ford Global Technologies, Inc. if isempty(d) str = ''; else allP = getptrsnosf(d); expand = 0; for i=1:length(allP) if allP(i).isa('cglookup') || allP(i).isa('cgfeature') || strncmp('Sum', getname(d), 3) expand = 1; break end end if expand inputs = getinputs(d); if d.NLeft==0 str=''; else names = pveceval(inputs(1:d.NLeft), @charlistshort); str = sprintf('%s + ', names{:}); str = str(1:end-3); if d.NLeft>1 str = ['(' str ')']; end end if d.NRight==0 rstr=''; else names = pveceval(inputs(d.NLeft+1:end), @charlistshort); rstr = sprintf('%s + ', names{:}); rstr = rstr(1:end-3); if d.NRight>1 rstr = ['(' rstr ')']; end if d.NLeft rstr = [' - ' rstr]; else rstr = ['-' rstr]; end end str=[str rstr]; else str = getname(d); end end