I want to increase my cell's length by 8 times, by making each and every element copying by 8 times.

1 visualización (últimos 30 días)
If i have a cell of size 2*1 containing 2 elements cat and dog. Now I want to increase my cell size by 16*1, by making my 1st 8 elements as cat and next 8 elements as dog. If anyone could help me solve it by loops or any other means, it would be a great help. Thanks !!!!

Respuesta aceptada

Stephen23
Stephen23 el 27 de Sept. de 2021
C = {'cat','dog'};
D = repelem(C,8)
D = 1×16 cell array
{'cat'} {'cat'} {'cat'} {'cat'} {'cat'} {'cat'} {'cat'} {'cat'} {'dog'} {'dog'} {'dog'} {'dog'} {'dog'} {'dog'} {'dog'} {'dog'}

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements 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