How to save iteration values as array if for loop- for t=0:0.5:3?
1 次查看(过去 30 天)
显示 更早的评论
Dear Experts, I need to save M(t) iteration values as array if for loop as follows:
for t=0:0.5:3
M(t)=a2.*(exp(-(t./T1)))
end
This gives error as 'Subscript indices must either be real positive integers or logicals'.
Please help.
0 个评论
采纳的回答
kowshik Thopalli
2017-8-9
Use another index value outside the loop and keep updating it inside the loop such as
index=1
for t=0:0.5:3
M(index) = whatever you have
index=index+1
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!