Merge two vectors into matrix

조회 수: 549 (최근 30일)
Don Singh
Don Singh 2017년 1월 21일
답변: Idan Cohen 2020년 4월 22일
I have a time vector of 1x1024 double and an amplitude vector of 1024x1 double. How do I combine these vectors into a single matrix?

답변 (3개)

Andrei Bobrov
Andrei Bobrov 2018년 2월 7일
your_matrix = [vector1(:), vector2(:)];

Idan Cohen
Idan Cohen 2020년 4월 22일
Hi,
I have a similar question. I have three vectors - X, Y and Z.
How can I merge these vectors into on matris so I can plot 3-D surf graph?
Thanks.

Von Duesenberg
Von Duesenberg 2017년 1월 21일
Something like this?
vector1 = rand(1024,1);
vector2 = rand(1, 1024);
newVector = [vector1 vector2'];
  댓글 수: 3
Von Duesenberg
Von Duesenberg 2017년 1월 21일
You're right, Guillaume. Thanks for this.
Mohammed Ayoub
Mohammed Ayoub 2018년 2월 7일
Use "horzcat" command after transposing one of the vector. The result will be horizontally concatenates arrays. Thanks

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

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by