www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@conboolean/tostring.m
function ch = tostring(obj) %TOSTRING Create string representation of constraint % % STR = TOSTRING(CON) % % See also CONBOOLEAN. % Copyright 2002-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. nc = length( obj.Constraints ); % number of constraints if nc > 1, ch = cell( 1, 2*nc-1 ); for i = 1:nc, ch{2*i-1} = tostring( obj.Constraints{i} ); end [ch{2:2:(end-1)}] = deal( sprintf( ' %s ', upper( obj.Op ) ) ); ch = [ ch{:} ]; elseif nc == 1 && strcmpi( obj.Op, 'none' ), ch = tostring( obj.Constraints{1} ); else ch = 'Empty boolean constraint'; end if nc > 0 && obj.Not, ch = [ 'NOT( ', ch, ' )' ]; else ch = [ '( ', ch, ' )' ]; end