필터 지우기
필터 지우기

How to augment a vector into another vector?

조회 수: 2 (최근 30일)
Muhammad Sardar Khan
Muhammad Sardar Khan 2015년 4월 14일
편집: Azzi Abdelmalek 2015년 4월 14일
v1 = [0 1 2 3],
v2 = [0 1 2]
the resultant
v3 =[0 0;
1 0;
2 0;
3 0;
0 1;
1 1;
2 1;
3 1;
0 2;
1 2;
2 2;
3 2]

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2015년 4월 14일
v1 = [0 1 2 3],
v2 = [0 1 2]
[a,b]=ndgrid(v1,v2)
out=[a(:) b(:)]

추가 답변 (1개)

tdd4c1
tdd4c1 2015년 4월 14일
v3 = [repmat(v1',3,1) reshape(repmat(v2,4,1),1,[])']

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by