how can make a matrix from many vectors?

2 ビュー (過去 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
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 10 月 18 日
or vertcat

サインインしてコメントする。


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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by