在MATLAB Signal Processing Toolbox中取消findpeaks警告 [英] suppress findpeaks warnings in MATLAB Signal Processing Toolbox
本文介绍了在MATLAB Signal Processing Toolbox中取消findpeaks警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用了MATLAB信号处理工具箱中的函数 findpeaks .但是每次该函数找不到任何峰值时,我都会收到警告:
I use the function findpeaks from MATLAB's Signal Processing Toolbox. But everytime the function does not find any peaks I receive the warning:
Warning: No peaks found.
> In findpeaks at 83
现在我还是要处理这些情况,因此请检查findpeaks
返回的向量是否为空.因此,我想禁止显示这些警告,因为我不希望我的命令窗口变得混乱.
Now I have to handle those cases anyway and therefore check if the vector returned by findpeaks
is empty. So I would like to suppress those warnings, because I don't want my Command Window to get cluttered up.
推荐答案
首先确定警告ID:
findpeaks([1 1 1 1 ]);
[msg id] = lastwarn;
然后关闭警告:
warning('off',id)
这篇关于在MATLAB Signal Processing Toolbox中取消findpeaks警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文