How do I create a vector by repeating a vector

조회 수: 9 (최근 30일)
Onovo
Onovo 2021년 7월 28일
댓글: darova 2021년 7월 28일
Given a Vector A=[1; 2], I want to create a vector B, such that B=[1; 2; 1; 2] . Thanks

답변 (1개)

KSSV
KSSV 2021년 7월 28일
편집: KSSV 2021년 7월 28일
A = [1; 2] ;
B = repmat(A,2,1)
B = 4×1
1 2 1 2

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by