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

1 view (last 30 days)
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 !!!!

Accepted Answer

Stephen23
Stephen23 on 27 Sep 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'}

More Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!