语法
assert(cond)
assert(cond,msg)
assert(cond,msg,A1,......,An)
assert(cond,errID,msg)
assert(cond,errID,msg,A1,...,An)
断言条件,指定为有效的 MATLAB 表达式。...说明
如果 cond 为 false,assert(cond) 会引发错误。
如果 cond 为 false,assert(cond,msg) 会引发错误并显示错误消息 msg。
...assert(isa(c,'double'),'Product is type %s, not double.'...function x = quadraticSolver(C)
validateattributes(C,{'numeric'},{'size',[1 3]})
a = C(1);
b = C(2)