Why do I get the error message of using too many input argument when using the spectrogram function?
Ältere Kommentare anzeigen
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.
Akzeptierte Antwort
Weitere Antworten (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 Kommentare
Claudia Stirnat
am 24 Mai 2017
Jan
am 24 Mai 2017
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
am 24 Mai 2017
Bearbeitet: Claudia Stirnat
am 24 Mai 2017
Kategorien
Mehr zu Time-Frequency Analysis finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!