reiterating 1s and 0s in a single column

2 visualizaciones (últimos 30 días)
Michael Angeles
Michael Angeles el 29 de En. de 2022
Respondida: Voss el 29 de En. de 2022
Hello how do I make my data repeat x amount of times in the same column by copying the original sequence of data?
example data:
Column A has binary data [0;1;1;1;1;0;1;1]
Thank you!

Respuesta aceptada

Voss
Voss el 29 de En. de 2022
Use repmat():
A = [0;1;1;1;1;0;1;1];
x = 4;
B = repmat(A,x,1);
disp(B);
0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1

Más respuestas (0)

Categorías

Más información sobre Workspace Variables and MAT-Files en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by