Effacer les filtres
Effacer les filtres

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 vue (au cours des 30 derniers jours)
JK
JK le 17 Sep 2017
Réponse apportée : Jan le 17 Sep 2017
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.
  1 commentaire
per isakson
per isakson le 17 Sep 2017
What do the three dots between 1 1 1 and 2 2 2 stand for?

Connectez-vous pour commenter.

Réponse acceptée

Jan
Jan le 17 Sep 2017

Plus de réponses (1)

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

Catégories

En savoir plus sur Multidimensional Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by