Removing a blank string from a cell array
29 次查看(过去 30 天)
显示 更早的评论
I want to read all words except ','. So I have used strsplit to split by ','. There are 3 words, but after splitting, it should have 3 words, but length of mm (after executing the complete program) is still 4. How can I delete an specific cell array.
lo='Pushkar,Hanumangarh,Sangaria,';
mm=strsplit(lo,',')
mm
for i=1:length(mm)
A(i)=length(mm{i})
end
id=find(A==0)
mm{id}=[]
0 个评论
采纳的回答
Jos (10584)
2017-10-26
编辑:Jos (10584)
2017-10-26
mm(cellfun('isempty',mm)) = [] % remove empty cells from mm
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!