Index must not exceed 10, but why???
조회 수: 2 (최근 30일)
이전 댓글 표시
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??
댓글 수: 0
채택된 답변
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
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
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 Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!