Index must be a positive integer or logical.
1 回表示 (過去 30 日間)
古いコメントを表示
I am getting the following error while running the code:
Attempted to access R1_rk4(17501); index must be a positive integer or logical.
Here's a part of my code where the problem lies:
ie1 = 1 + 0.000035/h1;
R1_te = R1_rk4(ie1);
e_R1 = abs(R1_te - R3_te);
Btw, R1_rk4 is a vector, not a matrix. h1 is a constant (time step in the problem). I am trying to access a specific element of the vector R1_rk4 whose size is (1 x 80000).
Any help in removing the error would be much appreciated.
0 件のコメント
採用された回答
Azzi Abdelmalek
2012 年 10 月 27 日
編集済み: Azzi Abdelmalek
2012 年 10 月 27 日
The problem is in
R1_te = R1_rk4(ie1);
what is the value of ie1
ie1 must be a positive integer or logical.
その他の回答 (2 件)
Image Analyst
2012 年 10 月 27 日
What's the value of ie1? Is it an integer? Maybe you want
integerIndex = max([1 round(ie1)]);
R1_te = R1_rk4(integerIndex);
参考
カテゴリ
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!