How to create array from saved iterations of a loop
25 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Joseph McGorry
le 23 Août 2021
Commenté : Stephen23
le 23 Août 2021
I am wondering how I would create an array of numbers from a loop in matlab. After every iteration a number is saved and I want to be able to put all these outputs in one array. My outputs look like
x = 2
x = 3
x = 4
and so on.....
I want it so at the end of the loop the answer says
x = [2,3,4]
Thank you in advance
0 commentaires
Réponse acceptée
Plus de réponses (1)
Awais Saeed
le 23 Août 2021
Just store them column by column
for jj = 1:1:5
x(jj) = jj
end
2 commentaires
Awais Saeed
le 23 Août 2021
I do not know how your code is working but if you are getting values saved (as you said in question) then you should be able to save them as arrays
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!