Borrar filtros
Borrar filtros

repmat

13 visualizaciones (últimos 30 días)
osman yurdakul
osman yurdakul el 22 de Mzo. de 2011
i try to create an array as following by using repmat() function:
i have h array
h = [1 2 3 4 5]
and i want to carry out this:
h2 = [1 1 2 2 3 3 4 4 5 5]
by using repmat() func. i want to make each element of this array(h) double like in h2... please help me out ...

Respuesta aceptada

Matt Fig
Matt Fig el 22 de Mzo. de 2011
N = 2; % The number of times each element will repeat...
h2 = reshape(repmat(h,N,1),1,N*length(h))
  4 comentarios
Walter Roberson
Walter Roberson el 22 de Mzo. de 2011
h2 = reshape(repmat(h,N,1),numels(h)*N,1);
osman yurdakul
osman yurdakul el 22 de Mzo. de 2011
thanks for your helping. That's been really worked.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by