⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ensure.m

📁 Matlab程序
💻 M
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -