How do I create a vector by repeating a vector

Given a Vector A=[1; 2], I want to create a vector B, such that B=[1; 2; 1; 2] . Thanks

Answers (1)

A = [1; 2] ;
B = repmat(A,2,1)
B = 4×1
1 2 1 2

Categories

Tags

Asked:

on 28 Jul 2021

Commented:

on 28 Jul 2021

Community Treasure Hunt

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

Start Hunting!