Deleting zeros from cell matrix without resizing or reshaping matrix
23 次查看(过去 30 天)
显示 更早的评论
I have a cell matrix like this
[1] [2] [6] [2] [6] [6] [1] [0] [0]
[1] [7] [2] [5] [0] [6] [4] [7] [1]
[3] [2] [0] [2] [6] [7] [4] [7] [3]
and i want to delete zeros without changing the size or shape of the cell matrix
this the result i want
[1] [2] [6] [2] [6] [6] [1] [] []
[1] [7] [2] [5] [] [6] [4] [7] [1]
[3] [2] [] [2] [6] [7] [4] [7] [3]
0 个评论
采纳的回答
Azzi Abdelmalek
2014-12-25
编辑:Azzi Abdelmalek
2014-12-25
a={ 1 2 6 2 6 6 1 0 0;1 7 2 5 0 6 4 7 1;3 2 0 2 6 7 4 7 3 }
a(cellfun(@not,a))={[]}
0 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!