Combining 2 vectors?
조회 수: 197 (최근 30일)
이전 댓글 표시
Sorry if bit of a silly question but how would i combine 2 vectors as below? Thanks in advance
a1 [ 1,2,3,4,5,6] a2 [ 7,8,9,10,11]
a3 = [1,2,3,4,5,6,7,8,9,10,11]
댓글 수: 0
채택된 답변
John D'Errico
2018년 3월 31일
You created a1 as
a1 = [1,2,3,4,5,6];
and a2 as
a2 = [7,8,9,10,11];
So why would you not be able to create a3 as
a3 = [a1,a2];
TRY IT!
댓글 수: 4
Chumani
2022년 9월 14일
- Define a vector Y = (4, 7, -5, 10, 11, 0, -3, 12, 8, 19) and compute:
- length(Y),
- size(Y),
- Y(10)=-Y(4),
- Y(11)=Y(7)-Y(3).
Make the third and fifth elements equal to nine
Chaman Sabharawal
2024년 11월 11일
편집: Chaman Sabharawal
2024년 11월 11일
x=1:2:16, y=12:2:16,
z(1:2:16) =x;
z(2:2:16)=y
merges x and y interveavingly
추가 답변 (1개)
Suryansh Shukla
2021년 12월 2일
As the question was already answered but if you have a column vector like a1 = [1,2,3,4,5,6]';
a2 = [7,8,9,10,11,12]';
then you can use
a3 = [a1;a2]
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!