Combining Matrices

hello im Ahmat i have encountered a problem it is related to the this one http://www.mathworks.com/matlabcentral/answers/13101-combine-many-matrices-into-one
but my problem is different i have A1,A2...An matrices and i want to combine them as B=[A1;A2;..;An] how can i do that in a loop or something(i have to do in in a loop )
ex A1=[2 3];A2=[4 5];A3=[5 6]; B=[2 3;4 5;5 6]
thanks

Risposte (2)

bym
bym il 10 Ott 2011

0 voti

B = [A1; A2; A3];

2 Commenti

Ah01mat
Ah01mat il 10 Ott 2011
i have to do it in a loop what if i have billion of matrices ? what can i do
bym
bym il 10 Ott 2011
literally 'billions'? (apologies to Carl Sagan)

Accedi per commentare.

Fangjun Jiang
Fangjun Jiang il 10 Ott 2011

0 voti

Hope it's not too late. The better approach is not to name your variable as A1, A2, A3. This problem has been asked numerous times on this forum.

3 Commenti

Ah01mat
Ah01mat il 11 Ott 2011
No I didnt ask for giving names to the variables I just need to combine them or merge them in a loop
Fangjun Jiang
Fangjun Jiang il 11 Ott 2011
The point is, if the data is not named as A1, A2, A3, you don't need to combine them at all. Are you taking the data from somewhere else, or the data is created by you?
Walter Roberson
Walter Roberson il 11 Ott 2011
Read the FAQ in reverse. If the FAQ tells you how to assign to variable names in a loop, then by flipping the statements around, it also tells you how to retrieve from variable names in a loop.

Accedi per commentare.

Categorie

Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange

Richiesto:

il 10 Ott 2011

Community Treasure Hunt

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

Start Hunting!

Translated by