有时,根据图像的大小,当我调用 addframe
时在 MATLAB 中向视频添加 2D 图像时,我收到以下警告消息。
Warning: The frame height has been padded to be a multiple of four as required by the specified codec. In avifile.addframe at 127
我的问题是:
是否有任何方法可以像这样消除特定警告?如果是这样,是否可以在我的代码中的变量中捕获警告(即类似于 try & catch 异常机制)而不是让 MATLAB 在命令窗口中打印此警告?
如果上述情况不可行。有没有办法在 MATLAB 中暂时消除所有警告?
最佳答案
使用 warning
命令,您可以通过 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.
有关warning
命令的更多帮助,请在 MATLAB 命令行中键入 help warning
。
关于matlab - 在 MATLAB 中消除警告消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6651208/