ensure.m
来自「Matlab程序」· M 代码 · 共 18 行
M
18 行
function ensure( callerStr, mssgStr )
%ensures that an expression is true
%use for defensive progamming so that bugs may be found quickly
if not(ischar(callerStr))
error('"ensure" expression must be a string, since assert uses evalin')
end
assertionIsTrue = evalin( 'caller', callerStr );
if ( not(assertionIsTrue) ),
if ( nargin == 1 ), mssgStr = ''; end
disp(mssgStr)
error( ['ensure expression is false: ',callerStr] )
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?