Index exceeds matrix dimensions error
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
mohamad mohamad
il 10 Dic 2014
Commentato: Image Analyst
il 10 Dic 2014
hi i was running this simple code,but i got this error,any idea how to fix it?
L = 140; % Length of signal
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
YY = fft(rawdata,NFFT)/L;
((((((((((Index exceeds matrix dimensions.))))))))
Error in Untitled2 (line 11)
YY = fft(rawdata,NFFT)/L;
4 Commenti
Star Strider
il 10 Dic 2014
Next step:
In the Command Window, type
which fft -all
after the error.
I get 6 answers, all in: C:\Program Files\MATLAB\.
Risposta accettata
Image Analyst
il 10 Dic 2014
How can you take 256 samples from an array with 140 samples? Maybe you need to pad it with zeros or something
newArray = [oldArray, zeros(1, NFFT - length(oldArray))];
6 Commenti
Image Analyst
il 10 Dic 2014
OK, glad it works, though I don't know why since the help for fft() said that it would do that padding for you.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!