How do I create a vector by repeating a vector

2 次查看(过去 30 天)
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