index exceeds no of array elements

조회 수: 1 (최근 30일)
Shalu Mathew
Shalu Mathew 2020년 2월 23일
답변: Image Analyst 2020년 2월 23일
I ran a matlab code today and I recieved this error. Hope you guys can help.
BB= 4000;
UB = rand((t-q),BB);
indx = round(1+(t-q+1)*UB);
estar = ehat(indx);
Index exceeds the number of array elements (237).

답변 (1개)

Image Analyst
Image Analyst 2020년 2월 23일
What about the error do you not understand? It says that the "Index exceeds the number of array elements" meaning that indx is greater than the length of ehat array which is 237. That is unless you overwrote the built-in functions rand() and round() with your own functions or variables. Take the semicolon off and see what it is:
indx = round(1+(t-q+1)*UB)
whos indx
whos ehat
estar = ehat(indx);

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by