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!