is it possible to check warning message?
1 view (last 30 days)
Show older comments
I would like to check if a function display a warning or not? Is it possible?
0 Comments
Accepted Answer
Image Analyst
on 17 Mar 2015
Try using lastwarn:
% Initialize the global lastwarn variable to "Success"
lastwarn('Success')
% Some code that may or may not produce an error
a=10;
% Check if a warning was issued.
if strcmp(lastwarn, 'Success')
% All is well - no warning.
fprintf('All is well - no warning.\n');
else
% A warning was issued.
fprintf('A warning was issued..\n');
end
0 Comments
More Answers (0)
See Also
Categories
Find more on Argument Definitions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!