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

1 vue (au cours des 30 derniers jours)
archana malagi
archana malagi le 9 Août 2017
Commenté : archana malagi le 9 Août 2017
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.

Réponse acceptée

kowshik Thopalli
kowshik Thopalli le 9 Août 2017
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

Plus de réponses (0)

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by