필터 지우기
필터 지우기

Combining Matrices

조회 수: 2 (최근 30일)
Ah01mat
Ah01mat 2011년 10월 10일
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

답변 (2개)

bym
bym 2011년 10월 10일
B = [A1; A2; A3];
  댓글 수: 2
Ah01mat
Ah01mat 2011년 10월 10일
i have to do it in a loop what if i have billion of matrices ? what can i do
bym
bym 2011년 10월 10일
literally 'billions'? (apologies to Carl Sagan)

댓글을 달려면 로그인하십시오.


Fangjun Jiang
Fangjun Jiang 2011년 10월 10일
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
Fangjun Jiang
Fangjun Jiang 2011년 10월 11일
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 2011년 10월 11일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by