How to add elements to the end of an array?

358 ビュー (過去 30 日間)
Angela  Albrecht
Angela Albrecht 2016 年 10 月 27 日
回答済み: Santiago Alcantara 2022 年 2 月 10 日
I have two arrays:
alpha = [ 1 2 3 4 5]; beta = [ 6 7 8 9 10 11 12];
I'd like to add beta to the end of alpha so they form gamma
gamma = [1 2 3 4 5 6 7 8 9 10 11 12];
How would I go about doing this?
  3 件のコメント
Image Analyst
Image Analyst 2018 年 1 月 27 日
Punnag, you can put "Answers" down below in the "Answers" section rather than up here. Though, I doubt there's a need to post a duplicate of the answer down there that was already posted 4 months ago.
Punnag Chatterjee
Punnag Chatterjee 2018 年 2 月 2 日
Thanks for this info.

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

採用された回答

John Wirzburger
John Wirzburger 2016 年 10 月 27 日
gamma = [alpha beta];
  5 件のコメント
suong Tran
suong Tran 2017 年 12 月 4 日
Thank you!
James Tursa
James Tursa 2018 年 2 月 5 日
@ Charles. This comment does not appear to be sufficiently related to the original Question. Suggest you delete this comment and open up a new Question about your specific problem.

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

その他の回答 (2 件)

Santiago Alcantara
Santiago Alcantara 2022 年 2 月 10 日
Also you can enlarge it the of two. In others words:
you have
alpha = [ 1 2 3 4 5]
alpha = 1×5
1 2 3 4 5
beta = [ 6 7 8 9 10 11 12]
beta = 1×7
6 7 8 9 10 11 12
alpha(6:12)=beta
alpha = 1×12
1 2 3 4 5 6 7 8 9 10 11 12

Mebin A Abraham
Mebin A Abraham 2020 年 4 月 14 日
how can i add elements in an array..... suppose A=[ 1 2 3 4]....i want to get sum of the numbers..ie.1+2+3+4=10.........for that what is the function
  1 件のコメント
Dinesh Brindavanam
Dinesh Brindavanam 2020 年 4 月 18 日
B = sum(A)

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

カテゴリ

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