Merge two vectors into matrix

535 visualizaciones (últimos 30 días)
Don Singh
Don Singh el 21 de En. de 2017
Respondida: Idan Cohen el 22 de Abr. de 2020
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?

Respuestas (3)

Andrei Bobrov
Andrei Bobrov el 7 de Feb. de 2018
your_matrix = [vector1(:), vector2(:)];

Idan Cohen
Idan Cohen el 22 de Abr. de 2020
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 el 21 de En. de 2017
Something like this?
vector1 = rand(1024,1);
vector2 = rand(1, 1024);
newVector = [vector1 vector2'];
  3 comentarios
Von Duesenberg
Von Duesenberg el 21 de En. de 2017
You're right, Guillaume. Thanks for this.
Mohammed Ayoub
Mohammed Ayoub el 7 de Feb. de 2018
Use "horzcat" command after transposing one of the vector. The result will be horizontally concatenates arrays. Thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by