Removing a blank string from a cell array
조회 수: 34 (최근 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!