MATLAB: Remove rows that contain zeros from cells array in matlab

cells array matlab

I have a cell array resulted from a certain code as follows:
m =
[ 0] 'GO:0008150'
'GO:0008150' 'GO:0016740'
'GO:0016740' 'GO:0016787'
'GO:0016787' 'GO:0006810'
'GO:0008150' 'GO:0006412'
'GO:0016740' 'GO:0004672'
'GO:0016740' 'GO:0016779'
'GO:0016787' 'GO:0004386'
'GO:0016787' 'GO:0003774'
'GO:0016787' 'GO:0016298'
'GO:0006810' 'GO:0016192'
'GO:0006412' 'GO:0005215'
'GO:0004672' 'GO:0030533'
[ 0] 'GO:0008150'
[ 0] 'GO:0016740'
'GO:0008150' 'GO:0016787'
'GO:0008150' 'GO:0006810'
'GO:0006810' 'GO:0006412'
[ 0] 'GO:0004672'
[ 0] 'GO:0016779'
[ 0] 'GO:0004386'
'GO:0016192' 'GO:0003774'
[ 0] 'GO:0016298'
[ 0] 'GO:0016192'
'GO:0006810' 'GO:0005215'
'GO:0005215' 'GO:0030533'
I need to remove the rows which contains zero (for example: in the above cells array m, row one should be deleted because we have a zero in the first column). so how can I create an array from this array that doesn't contain zeros?

Best Answer

m(cellfun(@(x) ~x(1),m(:,1)),:) = []
Related Question