How do I create a vector by repeating a vector

2 ビュー (過去 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
  2 件のコメント
Onovo
Onovo 2021 年 7 月 28 日
Thanks pal
darova
darova 2021 年 7 月 28 日

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

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by