How do I add 1 arrays elements into another array

조회 수: 3 (최근 30일)
Tyler Jacobson
Tyler Jacobson 2017년 9월 22일
댓글: Jan 2017년 9월 22일
I would like to amend 1 matrix into another matrix of the same size that would double the array in length. For instance I have a 1 x 1001 matrix that I would like to add to another matrix of 1 x 1001 to make 1 1 x 2002 matrix

답변 (1개)

Adam
Adam 2017년 9월 22일
  댓글 수: 1
Jan
Jan 2017년 9월 22일
Or with the comma explicitly:
a = [b, c]
This avoid some troubles in the case of using numerical scalars and operators, see:
[2-3], [2 -3], [2 - 3], [2, -3]
But in your case it is unequivocal.
Alternative:
cat(2, b, c)
or
horzcat(b, c)

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by