cell2mat error in arraycell
1 次查看(过去 30 天)
显示 更早的评论
Sis=app.StrategyAggreg_UITable2.Data(:,3);
xx=logical(cell2mat(Sis));
Error using cell2mat
All contents of the input cell array must be of the same data type.
0 个评论
采纳的回答
更多回答(1 个)
Matt J
2023-11-19
load Check
xx=cellfun(@logical,Sis)
1 个评论
Walter Roberson
2023-11-19
编辑:Walter Roberson
2023-11-19
load Check
classes = cellfun(@class, Sis, 'uniform', 0);
unique_classes = unique(classes)
mask = classes == "logical";
unique([Sis{mask}])
unique([Sis{~mask}])
So Sis contains cells with logical 0 (false) and logical 1 (true), but it also contains cells with numeric 0 and numeric 1.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!