Hi, i want my following vector:
A = [0,1; 1; 5; 10; 20]
to be
A = [0,1; 1; 5; 10; 20;0,1; 1; 5; 10; 20;0,1; 1; 5; 10; 20; ... ]
(50 times repeated)

 採用された回答

Mahmoud
Mahmoud 2023 年 10 月 20 日
編集済み: Mahmoud 2023 年 10 月 20 日

2 投票

A = [0; 1; 5; 10; 20]; % Vector declaration
B = repmat(A, 50, 1); % Replicate Fifty times

1 件のコメント

Furkan Sencer Kaçar
Furkan Sencer Kaçar 2023 年 10 月 20 日
Thank you very much :)

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

その他の回答 (1 件)

William Rose
William Rose 2023 年 10 月 20 日

1 投票

A = [0,1; 1; 5; 10; 20]
is not valid because it uses a comma as well as semicolons. I assume you meant to write
A = [0; 1; 1; 5; 10; 20];
Then do
A=repmat(A,50,1);
Check:
size(A)
ans = 1×2
300 1
OK.

カテゴリ

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

製品

リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by