Index exceeds the number of array elements (1).

조회 수: 2 (최근 30일)
Sergio Diaz
Sergio Diaz 2019년 10월 29일
댓글: Guillaume 2019년 11월 1일
data=load('triplicado.txt');
I=input('Ingresa 1(lineal), 2(exponencial) ó 3(potencia)= ')
if I==1;
A=mincuad(x,y);
elseif I==2;
B=expo(x,y);
else
C=potencia(x,y);
end
  댓글 수: 1
Guillaume
Guillaume 2019년 11월 1일
When asking for help with an error, always give us the full text of the error message. Copy/paste everything in red.

댓글을 달려면 로그인하십시오.

답변 (1개)

Siriniharika Katukam
Siriniharika Katukam 2019년 11월 1일
Hi
This error is caused because you are attempting to reference a nonexistent element of an array.Common causes for this may be like changing the size of an array unexpectedly or encountering an empty array when you expected a nonempty array. Stop MATLAB on the line where the error occurs. Verify that the size of the array into which you are referencing is large enough so that the index you are using falls before the last element of the array.
  댓글 수: 1
Guillaume
Guillaume 2019년 11월 1일
Another common reason for this is that you've named a variable min or max or sum and are then trying to use the min or max or sum function but end up indexing your variable instead.

댓글을 달려면 로그인하십시오.

카테고리

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