开发者

suppress findpeaks warnings in MATLAB Signal Processing Toolbox

开发者 https://www.devze.com 2023-01-29 00:07 出处:网络
I use the function findpeaks from MATLAB\'s Signal Processing Toolbox. But everytime the function does not find any peaks I receive the warning:

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

精彩评论

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