How to prevent cell array within cell array
显示 更早的评论
Dear Experts
I have two cell arrays. One cell array is a combination of another cell array.
name = { 'Tom', 'Tim'};
record = {'school', 'class', name};
Output becomes nested cell arrays. Desired Output:
record = {'school', 'class', 'Tom', 'Tim'}
Thank you for your help
1 个评论
>> record = [{'school', 'class'}, name]
record =
'school' 'class' 'Tom' 'Tim'
采纳的回答
更多回答(2 个)
Andrei Bobrov
2016-7-19
record = {'school', 'class', name{:}}
Star Strider
2016-7-19
This works:
name = { 'Tom', 'Tim'};
record = {'school', 'class', name};
record2 = {record{1:2}, record{3}{1:2}};
record2 =
'school' 'class' 'Tom' 'Tim'
类别
在 帮助中心 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!