D = load('C.mat');
C = D.C;
for k = 1:numel(C)
C{k}(:,1:4) = fillmissing(C{k}(:,1:4),'nearest');
filename = C{k}{1,2};
fn{k,:} = sprintf('%s.xlsx',filename{:});
writetable(C{k},sprintf('%s.xlsx',filename{:}))
rowlen{k,:} = size(C{k}(:,9:12),1);
NaN912{k,:} = [varfun(@isnan,C{k}(:,9:12))];
PctNaN(k,:) = table2array(varfun(@(x)sum(x)./size(x,1),NaN912{k,:}));
end
VarNms = compose('NAN in %s', string(C{1}.Properties.VariableNames(:,9:12)));
filnam = cell2table(fn,'VariableNames',{'File name'});
NaNPercent = array2table(PctNaN, 'VariableNames',VarNms);
NaNPercent = [filnam NaNPercent];
FirstTen = NaNPercent(1:10,:)
Best Answer