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!