How to add elements to the end of an array?

조회 수: 387 (최근 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

카테고리

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