How to hide warnings ?
显示 更早的评论
I do not want warnings to appear when i execute my code but i do not want to turn them off as well. Is this possible?
采纳的回答
更多回答(2 个)
Image Analyst
2012-7-23
This snippet of code and the instructions (in comments) will help you to turn off specific warnings:
% Turn off this warning "Warning: Image is too big to fit on screen; displaying at 33% "
% To set the warning state, you must first know the message identifier for the one warning you want to enable.
% Query the last warning to acquire the identifier. For example:
% warnStruct = warning('query', 'last');
% messageID = warnStruct.identifier
% messageID =
% Images:initSize:adjustingMag
warning('off', 'Images:initSize:adjustingMag');
Adapt it for the warning you want to turn off by following those instructions in the comments.
Daniel Shub
2012-7-23
I believe that one can prevent warnings without recoding or turning any warnings off by overloading warning. Something horrendous like
function varargout = warning(varargin)
varargout{1:narargin} = [];
end
类别
在 帮助中心 和 File Exchange 中查找有关 Programming Utilities 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!