how to remove zeros from a cell array
6 次查看(过去 30 天)
显示 更早的评论
suppose i have a set of coordinate (which is given like [(x1,x2); (x3,x4); (0,0); (x5;x6)]), in which many are zeros, if i remove zeros with the following code, i am getting all rest coordinates in a single row [x1,x2,x3,x4,x5,x6], which is not desired. Please help. Thank you.
SOUVIK
for j1=1: length(xcor1)
for i1=1:9
if ~isempty(DistanceInClass2{j1}{i1})
CorInClass2{j1}{i1}(CorInClass2{j1}{i1}==0)=[];
end
end
end
1 个评论
Jan
2019-3-28
You forgot to ask a question or mention, what you want to get instead. Do you want to remove rows, which contain a zero or only zeros?
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!