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

1 visualizzazione (ultimi 30 giorni)
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 !!!!

Risposta accettata

Stephen23
Stephen23 il 27 Set 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'}

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by