how to store more than one list into one list or one file to be includes all generated list from a loop ????

3 vues (au cours des 30 derniers jours)
hello every body...
i try to store generated lists in one list
here is the code:
Ylst=[];
for i=3
Y=[1*i;2;3];
Ylst(i)=Y;
end
this is the error:
In an assignment A(I) = B, the number of elements in B and I must be the same.
Can any body help to correct it please.. how to do it??
thanx in advence...

Réponse acceptée

Walter Roberson
Walter Roberson le 19 Juin 2015
Ylst={};
for i=3
Y=[1*i;2;3];
Ylst{i}=Y;
end
However as you are using fixed length lists you should consider using a 2D array:
Ylst=[];
for i=3
Y=[1*i;2;3];
Ylst(:,i)=Y;
end
  2 commentaires
Jack
Jack le 19 Juin 2015
Thank you so muck for your answer, it works but not give me the results i want.
you can see the the list of Y is changed in each and every loop but the result only give me the value of Y in last loop.
how to solve it
0 0 3
0 0 2
0 0 3
i want to see result as in the following :
1 2 3
2 2 2
3 3 3
patient please ...

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

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

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by