Parse varies of pair variable into function?
1 次查看(过去 30 天)
显示 更早的评论
I am writing my own function by using findpeaks and how can I parse those value into the findpeaks function?
tmp = {'MinPeakDistance',0.5, 'MinPeakHeight', -1.05};
%this may change such as ['MinPeakDistance',0.5, 'MinPeakHeight', 10, 'MinPeakProminence',0.06]
function myFindpeaks = myFunction(x, y, tmp)
findpeaks(y, x, tmp);
return
I know the function is incorrect, but I can't really know how to express in matlab syntax.
3 个评论
Andreas Dorner
2019-6-25
编辑:Andreas Dorner
2019-6-25
findpeaks(y, tmp{:});
Maybe? You dont need x in findpeaks and tmp{:} just pastes the cell content.
edit:
findpeaks(y, x, tmp{:}); %should also work
采纳的回答
Pullak Barik
2019-6-25
The comment by Andreas Dorner should help.
Basically, using
findpeaks(y, x, tmp{:});
should work out for you.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Estimation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!