cell operation
2 次查看(过去 30 天)
显示 更早的评论
There is a cell array. A = {'ab', 'bc', 'cd'};
I'd like to get a new cell array, like: B = {'ab', 'ab', 'ab', 'bc', 'bc', 'bc', 'cd', 'cd', 'cd'}.
How to get this without using loop?
Thanks
0 个评论
采纳的回答
Walter Roberson
2011-12-28
B = repmat(A, 3, 1); %do the duplication
B = B(:).' ; turn the result in to a row vector
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!