Vector operations

I'm looking for something that can repeat a vector without. For exemple, here a is repeated 4 times :
a = [1,2,5];
b = cellfun(a, 4);
b = [1 1 1 1 2 2 2 2 5 5 5 5];
thx

 Risposta accettata

Wayne King
Wayne King il 7 Nov 2011

0 voti

One way:
a = [1,2,5];
b = reshape(repmat(a,4,1),12,1);

Più risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by