Borrar filtros
Borrar filtros

Parse varies of pair variable into function?

2 visualizaciones (últimos 30 días)
Patrick C
Patrick C el 24 de Jun. de 2019
Comentada: Patrick C el 25 de Jun. de 2019
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 comentarios
Andreas Dorner
Andreas Dorner el 25 de Jun. de 2019
Editada: Andreas Dorner el 25 de Jun. de 2019
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 el 25 de Jun. de 2019
Himanshu Rai sorry for confuse. but I got the answer, plz check the below comment.
Andreas Dorner Yes, it works. Thanks a lot!

Iniciar sesión para comentar.

Respuesta aceptada

Pullak Barik
Pullak Barik el 25 de Jun. de 2019
The comment by Andreas Dorner should help.
Basically, using
findpeaks(y, x, tmp{:});
should work out for you.

Más respuestas (0)

Categorías

Más información sobre Spectral Estimation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by