Effacer les filtres
Effacer les filtres

for loop append variable

6 vues (au cours des 30 derniers jours)
il147
il147 le 18 Fév 2022
Commenté : il147 le 22 Fév 2022
i'd like to append variable n0 to n1
but this code made just last variable
Thanks!
leng=length(list)
n0=[]
for i=1:leng
nl=list(i).name
end
  6 commentaires
Stephen23
Stephen23 le 18 Fév 2022
That is why I showed you this approach:
{list.name}.'
Much simpler than a loop.
il147
il147 le 18 Fév 2022
It works!!!! Thanks for your help!!

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 18 Fév 2022
Modifié(e) : KSSV le 18 Fév 2022
You can make it a cell array.
leng=length(list)
nl = cell(leng,1) ;
for i=1:leng
nl{i}=list(i).name
end
You may access n1{1}.........n1{10}
  3 commentaires
KSSV
KSSV le 18 Fév 2022
You can do the same as shown above. Store them into a cell array.
il147
il147 le 22 Fév 2022
Do you have any idea to make it matrix form not cell array?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by