MATLAB: Removing zeros from rows of a cell matrix

MATLABmatrixnum2cell

I have a long 1 column matrix (891,1) where each row consists of either a name in characters or a zero in each row. How can I neaten up my matrix by getting rid of all the zeros in between leaving just a column of names?

Best Answer

C = C(cellfun('isclass', C, 'char'))