Search code examples
matlabcell-array

How to judge the data in a cell is 'invalid'


           ''    [  2281]    [  2520]    [8]
           ''          []          []     ''

Like above data in my cell array. How do I determine the second row is invalid? I tried isempty(), but the result is not optimal.


Solution

  • Use cellfun and all along columns with isempty as follows,

    >> invalidRow = all(cellfun(@isempty,C),2)
    
    invalidRow =
    
         0
         1