Add column vector to the end of another column vector
21 ビュー (過去 30 日間)
古いコメントを表示
Hello! I have two rather large data sets that I am trying to combine into one data set. For example vector A is a 50x1 vector and vector B is a 100x1 vector. How do I combine these two togeher to get a 150x1 vector? Thanks so much!
0 件のコメント
採用された回答
Hans Scharler
2023 年 10 月 31 日
移動済み: Voss
2023 年 10 月 31 日
A = rand(50,1); % example 50x1 vector
B = rand(100,1); % example 100x1 vector
C = vertcat(A,B) % concatenate A and B vertically
4 件のコメント
Dyuman Joshi
2023 年 10 月 31 日
@Wilson Meireles, The methods are equivalent, just the syntax is different.
From the documentation of vertcat - "vertcat is equivalent to using square brackets to vertically concatenate or append arrays. For example, [A; B] is the same as vertcat(A,B) when A and B are compatible arrays."
Voss
2023 年 10 月 31 日
@Wilson Meireles: If the problem is solved, don't forget to "Accept" this answer.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!