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)

 Akzeptierte Antwort

Mahmoud
Mahmoud am 20 Okt. 2023
Bearbeitet: Mahmoud am 20 Okt. 2023

2 Stimmen

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

Weitere Antworten (1)

William Rose
William Rose am 20 Okt. 2023

1 Stimme

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.

Kategorien

Produkte

Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by