필터 지우기
필터 지우기

Index must not exceed 10, but why???

조회 수: 2 (최근 30일)
Brenno Selli
Brenno Selli 2023년 2월 27일
댓글: Jan 2023년 2월 27일
I'm in trouble with this error
"Index exceeds the number of array elements. Index must not exceed 10
Error in ESTATISTICAS_DESCRITIVAS (line 51)
tempo(:,j) = 0:dt(j):(length(road_x1)-1)*dt(j) ;"
the code that I'm using right now is:
dt = transpose(dx1./v); %making it a 10x1 array
m = length(dt);
n = length(verticalperf1);
temp0 = zeros(m,n) ;
for j = 1:n
tempo(:,j) = 0:dt(j):(length(road_x1)-1)*dt(j) ;
end
verticalperf1 now is a vector 1x60001, I used this vector just because sometimes the length may change, using length(verticalperf1) makes the code run nicely and good all times.
the code results in a array (60001x10) called "tempo", its completely okay, the vallues are good and acurate, it works but the error is not allowing me to proceed, theres any way that I can solve it or just skip this error??

채택된 답변

Torsten
Torsten 2023년 2월 27일
이동: Torsten 2023년 2월 27일
If dt is an array of length 10, then "n" in the loop "for j = 1:n" must be <= 10 since you try to access dt(j).
Is this the case ? My guess is, no.
  댓글 수: 3
Image Analyst
Image Analyst 2023년 2월 27일
편집: Image Analyst 2023년 2월 27일
What is dt, dx1, and v?
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
save('anwers.mat', 'dt', 'verticalperf1', 'dx1', 'v')
then attach answers.mat with the paperclip icon.
Jan
Jan 2023년 2월 27일
@Brenno Selli: "I tryed it" - you tried what? Torsten has explained, what the error is. So what did you change in your code?

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by