Combination of 2 columns

1 visualización (últimos 30 días)
Cside
Cside el 14 de Feb. de 2020
Respondida: Stephen23 el 14 de Feb. de 2020
Hi, I have 2 vectors, A = 10x1, B = 6x1.
How do I create a 60x2 matrix where every element of A is matched to the element of B? Each row should reflect (A,B). Thanks! :)

Respuesta aceptada

Stephen23
Stephen23 el 14 de Feb. de 2020
[Am,Bm] = ndgrid(A,B);
M = [Am(:),Bm(:)]

Más respuestas (0)

Categorías

Más información sobre Matrices and Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by