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

回答 (1 件)

KSSV
KSSV 2021 年 7 月 28 日
編集済み: KSSV 2021 年 7 月 28 日

1 投票

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

2 件のコメント

Onovo
Onovo 2021 年 7 月 28 日
Thanks pal
darova
darova 2021 年 7 月 28 日

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

質問済み:

2021 年 7 月 28 日

コメント済み:

2021 年 7 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by