How to let Matlab know 'NaN' should be treated as NaN?

2 次查看(过去 30 天)
I have imported the following .xlsx file into Matlab:
My code:
U_sum24t = zeros(height(Z_24TimeSteps),1);
col_names24tU = Z_24TimeSteps.Properties.VariableNames;
for k = 1:height(Z_24TimeSteps)
col_to_sum24tU = any(cell2mat(...
cellfun(@(x) strcmp(col_names24tU,x),Z_24TimeSteps.U{k},...
'UniformOutput', false).'),1);
U_sum24t(k) = sum(Z_24TimeSteps{k,col_to_sum24tU});
end
Following error message occurs:
Undefined function 'sum' for input arguments of type 'cell'. I want to make Matlab treat all 'NaN' as NaN, so I can execute calculations. What I tried already: Replace NaN in Excel with blanks, then in Matlab > import data > "replace blanks with NaN" > not working and still displaying string format

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by