Combination of 2 columns

2 vues (au cours des 30 derniers jours)
Cside
Cside le 14 Fév 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! :)

Réponse acceptée

Stephen23
Stephen23 le 14 Fév 2020
[Am,Bm] = ndgrid(A,B);
M = [Am(:),Bm(:)]

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by