why get this message "Array indices must be positive integers or logical values." i for loop?
1 回表示 (過去 30 日間)
古いコメントを表示
I got the error message " Array indices must be positive integers or logical values"
I would appreciate any help. thanks in advance
for i = 1:0:1:600
iNext = i + 1;
do...
x(iNext) >= x(i) % assumed "i" is the current step and "iNext" is the Next step
end
0 件のコメント
回答 (1 件)
KALYAN ACHARJYA
2022 年 5 月 15 日
編集済み: KALYAN ACHARJYA
2022 年 5 月 15 日
Yes, Matlab allows indexing for positive integer only
x=zeros(1,600);
for i = 1:600
iNext=i + 1;
x(iNext)=x(i) % assumed "i" is the current step and "iNext" is the Next step
end
#Pls see the iteration process and your requirements
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!