Converting cell in double
22 次查看(过去 30 天)
显示 更早的评论
Hey Guys,
i have a 8942x1 cell and want to convert it into a 8942x1 double ? The final product should be look likes this:
[] 0
1 1
[] => 0
[] 0
[] 0
... ...
Thank you very much for your help!
Attached my file:
0 个评论
采纳的回答
Star Strider
2023-1-2
编辑:Star Strider
2023-1-2
Try something like this —
LD = load(websave('ids','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1249257/ids.mat'));
ids = LD.ids
idsd = cell2mat(ids)
idsmt = cellfun(@isempty,ids, 'Unif',0); % Detect Empty Cells
ids(cell2mat(idsmt)) = {0}; % Fill Missing Values With '0'
idsd = cell2mat(ids)
EDIT — Corrected typographical errors.
.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!