lets say i have an array x=[1 0 1] how can i sample every bit 10 times. output will be 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1

 Respuesta aceptada

Star Strider
Star Strider el 5 de Nov. de 2017
Editada: Star Strider el 5 de Nov. de 2017

0 votos

Try this:
x=[1 0 1];
N = 10;
Output = reshape(repmat(x(:)', N, 1), 1, [])

2 comentarios

Awesomer
Awesomer el 5 de Nov. de 2017
It works! Thank you so much.
Star Strider
Star Strider el 5 de Nov. de 2017
As always, my pleasure!

Iniciar sesión para comentar.

Más respuestas (1)

Steven Lord
Steven Lord el 5 de Nov. de 2017

0 votos

Use the repelem function.

Categorías

Etiquetas

Preguntada:

el 5 de Nov. de 2017

Comentada:

el 5 de Nov. de 2017

Community Treasure Hunt

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

Start Hunting!

Translated by