Removing a blank string from a cell array
34 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
ANKUR KUMAR
am 26 Okt. 2017
Bearbeitet: Jos (10584)
am 26 Okt. 2017
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 Kommentare
Akzeptierte Antwort
Jos (10584)
am 26 Okt. 2017
Bearbeitet: Jos (10584)
am 26 Okt. 2017
mm(cellfun('isempty',mm)) = [] % remove empty cells from mm
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Cell Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!