Combination of 2 columns

조회 수: 1 (최근 30일)
Cside
Cside 2020년 2월 14일
답변: Stephen23 2020년 2월 14일
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! :)

채택된 답변

Stephen23
Stephen23 2020년 2월 14일
[Am,Bm] = ndgrid(A,B);
M = [Am(:),Bm(:)]

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by