How to save iteration values as array if for loop- for t=0:0.5:3?

2 views (last 30 days)
Dear Experts, I need to save M(t) iteration values as array if for loop as follows:
for t=0:0.5:3
This gives error as 'Subscript indices must either be real positive integers or logicals'.
Please help.

Accepted Answer

kowshik Thopalli
kowshik Thopalli on 9 Aug 2017
Use another index value outside the loop and keep updating it inside the loop such as
for t=0:0.5:3
M(index) = whatever you have

More Answers (0)


Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!