Azzera filtri
Azzera filtri

array manipulation such as [ 1 2 5 7 3 .... ] --> [ 1 1 1 ... 2 2 2 ... 5 5 5 ... 7 7 7 ... 3 3 3 ... .... ].

1 visualizzazione (ultimi 30 giorni)
Using
A = [ 1 2 5 7 3 .... ],
I would like to create
B = [ 1 1 1 ... 2 2 2 ... 5 5 5 ... 7 7 7 ... 3 3 3 ... .... ]
Can you please show me a way to do that? Thanks.

Risposta accettata

Jan
Jan il 17 Set 2017
repelem(A, 3)

Più risposte (1)

michio
michio il 17 Set 2017
A = [ 1 2 5 7 3];
tmp = repmat(A,[3,1]);
B = tmp(:)';

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by