开发者

suppress findpeaks warnings in MATLAB Signal Processing Toolbox

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

Now I have to handle those cases anyway and therefore check if the vector returned by findpeaks is empty. So I wo开发者_如何学Pythonuld like to suppress those warnings, because I don't want my Command Window to get cluttered up.


First identify the warning id:

findpeaks([1 1 1 1 ]);
[msg id] = lastwarn;

Then switch off the warning:

warning('off',id)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜