How do I replace [ ] in an array with 0's
76 次查看(过去 30 天)
显示 更早的评论
How can i replace the [] in the pathrisk field with 0's?
Thanks for your help!
0 个评论
采纳的回答
更多回答(1 个)
Jos (10584)
2014-1-15
编辑:Jos (10584)
2014-1-15
If I am not mistaken, the variable pathrisk is a cell array with some empty cells?
pathrisk = {1 [] 5 3 [] [] 9} % example data
tf = cellfun('isempty',pathrisk) % true for empty cells
pathrisk(tf) = {0} % replace by a cell with a zero
4 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!