index exceeds no of array elements

3 Ansichten (letzte 30 Tage)
Shalu Mathew
Shalu Mathew am 23 Feb. 2020
Beantwortet: Image Analyst am 23 Feb. 2020
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).

Antworten (1)

Image Analyst
Image Analyst am 23 Feb. 2020
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);

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by