Building matrix from two vectors

조회 수: 61 (최근 30일)
Kdshdc Kdshdc
Kdshdc Kdshdc 2019년 10월 22일
답변: Adam Danz 2019년 10월 22일
Hi,
I am trying to merge two vectors into a single matrix. Both of them has only one line and 100 columns:
Vector A: (1x100)
B: (1x100)
However, the matrix I am trying to build is done with merging the first value from A with the second from B, separated by "," and a ";" after each pair.
So I can have something like this:
C=(a1,b1;a2,b2;a3,b3...)
Thank you very much.

채택된 답변

Adam Danz
Adam Danz 2019년 10월 22일
A = 1:100;
B = 101:200;
C = [A;B].'; % vertical concatenation & transpose

추가 답변 (0개)

카테고리

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