Assigning a cell array to a cell of a different cell array
显示 更早的评论
I need to assign a cell array to an element of a different cell array. ie:
child = {'a', 'b', 'c'};
parent = cell(2,1);
parent{1} =child;
This code works when child contains more than one element. However when child contains only one element, the element value is copied rather than a 1x1 cell array. ie:
child = {'a'};
parent = cell(2,1);
parent{1} = child;
In this case printing parent shows that the first element of parent is a string, 'a', rather than a 1x1 cell array. How can I override this behavior?
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Numeric Types 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!