MATLAB: How to fix this error

errormatlab errors

Dear all,
can you please help me to fix this error?
Index exceeds the number of array elements (9).
Error in Wavelet_freq (line 170)
figure(5), plot(wav10_30_50); ylabel('Amplitude'); xlabel('Time (s)');
What this error means?

Best Answer

  • What this error means?
    Index exceeds the number of array elements (9).
    Suppose, an array example A=[2 3 4 5 6 7 8]; Here the array A length is 7. Now if you try to acess the array indices more than 7, then MATLAB reflects such error, as indices value exceeds array length.
    for j=1:10
    Till j=7, there is no issue, once the iteration reaches j=8 and try to access A(8) here j=8, as A has 7 array elements only, then it shows such error. Please check in your code, such issue may arrised.