Borrar filtros
Borrar filtros

Vector operations

4 visualizaciones (últimos 30 días)
Steven
Steven el 7 de Nov. de 2011
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

Respuesta aceptada

Wayne King
Wayne King el 7 de Nov. de 2011
One way:
a = [1,2,5];
b = reshape(repmat(a,4,1),12,1);
  1 comentario
Andrei Bobrov
Andrei Bobrov el 7 de Nov. de 2011
b = reshape(ones(4,1)*a,1,[]);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by