Index exceeds the number of array elements. Index must not exceed 3.

120 views (last 30 days)
Akin Akinboboye
Akin Akinboboye on 24 Nov 2021
Answered: KSSV on 24 Nov 2021
for i=(k+1):5
quotient=floor(((rem*97)+Code(i))/16);
%quotient
rem=mod(((rem*97)+Code(i)),16);
Code(i)=quotient;
end
Index exceeds the number of array elements. Index must not exceed 3.
Error in Transmission_with_file (line 296)
quotient=floor(((rem*97)+Code(i))/16);

Answers (1)

KSSV
KSSV on 24 Nov 2021
This error occurs when you try to extract more number of elements then present in the array.
A = rand(1,4) ; % 1x4 array
A(1) % no error
ans = 0.5853
A(end) % no error, it will extract last element
ans = 0.4302
A(5) % error, as there is no 5th element.
Index exceeds the number of array elements. Index must not exceed 4.
In the same way, when you are indexing check the limits of indices. The indices should not exceed the dimensions of the array.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!