Reputation: 96294
Sometimes, depending on the size of an image, when I call addframe
in MATLAB to add 2D images to a video, I get the following warning message.
Warning: The frame height has been padded to be a multiple of four as required by the specified codec. In avifile.addframe at 127
My questions are:
Are there any ways of silencing specific warnings like this? If so, is it possible to capture a warning in a variable in my code (i.e. similar to the try & catch exception mechanism) rather than having MATLAB print this warning in the command window?
If the above is not possible. Is it there a way to silence all warnings in MATLAB temporarily?
Upvotes: 5
Views: 9678
Reputation: 23774
Using the warning
command, you can silence either all warnings or specific warnings by ID:
WARNING('OFF', 'MSGID')
andWARNING('ON', 'MSGID')
disable and enable the display of any warning tagged with message identifierMSGID
. (UseLASTWARN
to determine the identifier of a warning, or use theWARNING VERBOSE
feature described below.)WARNING
is not case sensitive when matching message identifiers.
For more help on the warning
command, type help warning
in the MATLAB command line.
Upvotes: 9