Error with findpeaks function...

8 ビュー (過去 30 日間)
Kiran
Kiran 2012 年 10 月 18 日
コメント済み: Bruna Krebs Kutche 2019 年 1 月 15 日
I found the findpeaks() function in the Matlab help which seems to be exactly what I need for my project however whenever I try to run the example program I get the following error:
Error using findpeaks (line 23)
Not enough input arguments.
This is what I typed in:
data = [2 12 4 6 9 4 3 1 19 7];
pks = findpeaks(data);
I am a little baffled as to what is wrong, this code is straight out of the example file, so why wouldn't it work? Any help in understanding would be appreciated, I'm sure there is some user error involved ;)
Thanks in advance, Kiran
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2012 年 10 月 18 日
post all your code, because
data = [2 12 4 6 9 4 3 1 19 7];
pks = findpeaks(data);
is fine

サインインしてコメントする。

回答 (1 件)

Wayne King
Wayne King 2012 年 10 月 18 日
編集済み: Wayne King 2012 年 10 月 18 日
It seems like you are not using the MathWorks' findpeaks function. If you enter
>>which -all findpeaks
Do you only get something like:
\matlab\toolbox\signal\signal\findpeaks.m
\matlab\toolbox\signal\signal\@dspdata\findpeaks.m % dspdata method
findpeaks.m is a function in the Signal Processing Toolbox. If you have another findpeaks.m somewhere in your MATLAB path that proceeds the MathWorks' function, then you will be calling that function and NOT the Mathworks' function.
You should remove that other findpeaks.m, or move to a folder not on the MATLAB path.
  1 件のコメント
Bruna Krebs Kutche
Bruna Krebs Kutche 2019 年 1 月 15 日
Oh my god, thank you so much for this advice!!!

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by