MATLAB: Parse varies of pair variable into function

parse varies variable into a function

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.

Best Answer

  • The comment by Andreas Dorner should help.
    Basically, using
    findpeaks(y, x, tmp{:});
    should work out for you.