5

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:

  1. 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?

  2. If the above is not possible. Is it there a way to silence all warnings in MATLAB temporarily?

Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
  • try the solutions in these: http://stackoverflow.com/questions/6408759/avoid-matlab-startup-warning-when-overloading-buildin-functions, http://stackoverflow.com/questions/4333949/suppress-findpeaks-warnings-in-matlab-signal-processing-toolbox – Amro Jul 11 '11 at 14:16
  • Alternatively, you could pad the frame height yourself to a multiple of four as required by the specified codec... – aardvarkk Jul 11 '11 at 14:20

1 Answers1

9

Using the warning command, you can silence either all warnings or specific warnings by ID:

WARNING('OFF', 'MSGID') and WARNING('ON', 'MSGID') disable and enable the display of any warning tagged with message identifier MSGID. (Use LASTWARN to determine the identifier of a warning, or use the WARNING 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.

You
  • 22,800
  • 3
  • 51
  • 64