Combination of 2 columns

1 visualizzazione (ultimi 30 giorni)
Cside
Cside il 14 Feb 2020
Risposto: Stephen23 il 14 Feb 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! :)

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Matrices and Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by