How can I make a vector of a repeating sequence

I want to make a vector with 40 repeats of [0 0 0 1] in a column so it would look like this: 0 0 0 1 0 0 0 1 (0 0 0 1)x40
How would I be able to make this?

 Akzeptierte Antwort

Amjad Green
Amjad Green am 21 Mär. 2018

1 Stimme

x=[0 0 0 1];n=length(x);k=1;j=1; for i=1:40 while j<=n y(k)=x(j); k=k+1; j=j+1; end j=1; end

Weitere Antworten (1)

David Fletcher
David Fletcher am 21 Mär. 2018
Bearbeitet: David Fletcher am 21 Mär. 2018

6 Stimmen

repmat([0 0 0 1],1,40)

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Mär. 2018

Kommentiert:

Jan
am 22 Mär. 2018

Community Treasure Hunt

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

Start Hunting!

Translated by