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

1 次查看(过去 30 天)
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 !!!!

采纳的回答

Stephen23
Stephen23 2021-9-27
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'}

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by