error in working with cell array
1 次查看(过去 30 天)
显示 更早的评论
I see this error:
??? Error using ==> cell2mat at 53 Cannot support cell arrays containing cell arrays or objects
when I define:
C is cell array result={A; B; C}; mydatamat=cell2mat(result);
So, what is the solution?
1 个评论
Nobel Mondal
2015-5-6
cell2mat function doesn't support a nested cell array within the input cell array.
It seems you have to convert C first into numeric, char or struct datatype depending on your data validity. Could you please give some info/pattern on how your A,B and C variables look like?
回答(1 个)
David Sanchez
2015-5-6
hi,
transform C into a matrix before concatenating A, B and C in result:
C = cell2mat(C);
result={A; B; C};
mydatamat=cell2mat(result);
A and B have to be matrices too.
1 个评论
David Sanchez
2015-5-6
your attempt to create your data matrix does not work because you are trying to apply cell2mat to a cell of cells: result is a cell containing (at least), another cell ( C ).
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!