Parse varies of pair variable into 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.

댓글 수: 3

Himanshu Rai
Himanshu Rai 2019년 6월 25일
The question is not clear. Can you please explain a bit more - what are your parameters, what exactly you are trying to achieve ?
Andreas Dorner
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
Patrick C
Patrick C 2019년 6월 25일
Himanshu Rai sorry for confuse. but I got the answer, plz check the below comment.
Andreas Dorner Yes, it works. Thanks a lot!

댓글을 달려면 로그인하십시오.

 채택된 답변

Pullak Barik
Pullak Barik 2019년 6월 25일

0 개 추천

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

추가 답변 (0개)

카테고리

질문:

2019년 6월 24일

댓글:

2019년 6월 25일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by