Why do I get the error message of using too many input argument when using the spectrogram function?
이전 댓글 표시
I am using the following code:
path2=['D:\Uni\0-SysMuWi\Masterthesis\Musikausschnitte_Hoertest2\Klavier+Gesang.wav']
[a,Fs] = audioread(path2);
W=256;
h=hanning(W);
b=[2 4 6 8];
Y=64:
spectrogram(path2,h,W/2,Y,Fs)
And I get the error message:
Error using spectrogram Too many input arguments.
Error in spectrum_numerated (line 52) spectrogram(b,hanning(W),W/2,Y,Fs)
I also used "b" instead of "path2" in the spectrogram function but I still get the same error message.
채택된 답변
추가 답변 (1개)
The calling sequence is:
[s,f,t] = spectrogram(x,window,noverlap,f,fs)
x is the signal. I do noth think that the file name or "b" (what ever this mean exactly) is what you want. I'd expect a to be the first input.
I'm surprised that the code works at all, because this line should fail:
Y=64:
A trailing colon? Is this a typo in the forum? If yo, please post the code exactly how you run it.
댓글 수: 3
Claudia Stirnat
2017년 5월 24일
Jan
2017년 5월 24일
No, there is no connection to the file name. Try to identify the problem by using the debugger:
dbstop if error
Now run the code again until it stops. Look in the editor and search in the surrounding lines. The function spectrogram is called with 5 inputs, which is actually allowed. But perhaps you call it with unexpected arguments? Try to run the code examples from the documentation then. Do they run? Then examine, what is the difference to you way to call it.
Claudia Stirnat
2017년 5월 24일
편집: Claudia Stirnat
2017년 5월 24일
카테고리
도움말 센터 및 File Exchange에서 Time-Frequency Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!