Writing a program to combine multiple arrays

조회 수: 56 (최근 30일)
GL522
GL522 2020년 5월 6일
답변: Deepak Gupta 2020년 5월 6일
I am new to Matlab. How would I write a program to merge two arrays at a time multiple times. I have 13 arrays that need to be merged with each other once. Thank you.
  댓글 수: 2
Rik
Rik 2020년 5월 6일
Merge in what sense? Sum? Concatenate? In which direction?
GL522
GL522 2020년 5월 6일
Concatenate.

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

답변 (2개)

Rik
Rik 2020년 5월 6일
You can use the square brackets to concatenate arrays, or you can use the cat function.
[A;B;C]
cat(3,A,B,C)

Deepak Gupta
Deepak Gupta 2020년 5월 6일
Hello Grace,
You can simply concate 2 or more arrays in below fasion.
If A and B are 2 row arrays and you want A being appended by B, then...
Appended_A_by_B = [A B];
Will give you this result.
If A and B are column arrays then....
Appended_A_by_B = [A; B];
There is also a function cat which can be used to concatenate arrays or matrices. You can know more about it here:
Cheers

카테고리

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