MATLAB Answers

Combination of 2 columns

3 views (last 30 days)
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! :)

  0 Comments

Sign in to comment.

Accepted Answer

Stephen Cobeldick
Stephen Cobeldick on 14 Feb 2020
[Am,Bm] = ndgrid(A,B);
M = [Am(:),Bm(:)]

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.