How to combine two arrays

조회 수: 4 (최근 30일)
MIch
MIch 2022년 9월 30일
댓글: MIch 2022년 9월 30일
Hello,
for example there are a= [3 5 1] and b = [4 6 7]
How can I combine a and b to get c= [3 4 5 6 1 7]?

채택된 답변

Robert U
Robert U 2022년 9월 30일
Hi MIch,
have a look in the documentation under language fundamentals --> reshape()
a = [3 5 1];
b = [4 6 7];
c= reshape([a' b']',1,[])
c = 1×6
3 4 5 6 1 7
Kind regars,
Robert
  댓글 수: 1
MIch
MIch 2022년 9월 30일
Thank you very much

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

추가 답변 (1개)

zhehao.nkd
zhehao.nkd 2022년 9월 30일
Try reshape([a;b],1,[])
  댓글 수: 1
MIch
MIch 2022년 9월 30일
Thank you very much

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by