how can make a matrix from many vectors?

조회 수: 6 (최근 30일)
fatemeh
fatemeh 2013년 10월 18일
댓글: Azzi Abdelmalek 2013년 10월 18일
how can make a matrix from many vectors?
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 18일
You should precise column vectors or row vectors?
fatemeh
fatemeh 2013년 10월 18일
yes row vectors with same size 1*2,actually i have a for loop and it each time produce a vector with size 1*2 ,i want save this vector each time to a matrix

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

답변 (3개)

vaishali
vaishali 2013년 10월 18일
C = horzcat(A1, A2, ...) horizontally concatenates matrices A1, A2, and so on. All matrices in the argument list must have the same number of rows

Jos (10584)
Jos (10584) 2013년 10월 18일
편집: Jos (10584) 2013년 10월 18일
... and if the vectors are not of the same lengths, you can use PADCAT

Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 18일
out=[A1;A2;A3;...]
  댓글 수: 1
Azzi Abdelmalek
Azzi Abdelmalek 2013년 10월 18일
편집: Azzi Abdelmalek 2013년 10월 18일
out=zeros(1000,2) % Pre-allocate
for k=1:1000
out(k,:)=... % your calculations
end

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

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by