How to save variable in loop with different name?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i want to save each loop resust in varible of drought.
drougths=['june1965','june1969','june1974', 'july1987', 'july2002', 'july2006','aug1968', 'aug1979', 'aug1987', 'sep1952', 'sep1987','sep2001'];
j=1;
for i=[174, 222, 282,439,619,667, 212, 344, 440, 21, 441,609]
b(:,:)=IMD_SPI_01_12(i,:,:);
c=reshape(b,129,135);
for k=j
droughts(j)=c;
end
j=j+1;
end
0 commentaires
Réponses (1)
Walter Roberson
le 21 Sep 2019
1 commentaire
Walter Roberson
le 21 Sep 2019
By the way, you should be using
drougths={'june1965','june1969','june1974', 'july1987', 'july2002', 'july2006','aug1968', 'aug1979', 'aug1987', 'sep1952', 'sep1987','sep2001'};
Or if you have R2017a or later you can use your original line, but change every ' to " such as "june1965", "june1969"
Voir également
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!