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!