如果我理解你的问题的第一部分,你想删除 newfile 单元格数组中只包含空单元格的任何行 . 您可以使用函数CELLFUN来查找空单元格,使用函数ALL查找包含所有空单元格的行,然后使用logical indexing删除这些行:
>> newfile = cell(5,5); %# Empty cell array
>> newfile(:) = {''}; %# A different way to assign values without DEAL
>> newfile([1 2 4 5]) = {'a'} %# Make some non-empty cells
newfile =
'a' '' '' '' ''
'a' '' '' '' ''
'' '' '' '' ''
'a' '' '' '' ''
'a' '' '' '' ''
>> emptyIndex = cellfun('isempty',newfile) %# Logical index of empty cells
emptyIndex =
0 1 1 1 1
0 1 1 1 1
1 1 1 1 1
0 1 1 1 1
0 1 1 1 1