**matlab中warning函数用法**

1、warning函数:
显示警告消息。

2、用法说明:
此 MATLAB 函数 显示警告消息并设置 lastwarn 函数的警告状态。如果 msg 为空,则 warning 将重置 lastwarn 的警告状态,但不显示任何文本。
warning(msg)
warning(msg,A1,…,An)
warning(msgID,___)
warning(state)
warning(state,msgID)
warning
warnStruct = warning
warning(warnStruct)
warning(state,mode)
warnStruct = warning(state,mode)
另请参阅 dbstop, disp, error, errordlg, lasterror, lastwarn, sprintf, warndlg

3、例子:

 warning(['Your directory containes unremoved score cache files. Results may not be accurate.'...
       'Please remove any file in the format aXX.rr_* : ' ]);

警告: Your directory containes unremoved score cache files. Results may not be accurate.Please remove any file in the format aXX.rr_* :
注:
warning on 开启警告/显示警告
warning off 关闭警告/不显示警告
如:
(1)

 warning(['Your directory containes unremoved score cache files. Results may not be accurate.'...
       'Please remove any file in the format aXX.rr_* : ' ]);
        warning off 

(2)

warning(['Your directory containes unremoved score cache files. Results may not be accurate.'...
       'Please remove any file in the format aXX.rr_* : ' ]);
        warning on

猜你喜欢

转载自blog.csdn.net/Intangilble/article/details/83338715