Clear Filters
Clear Filters

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

2 views (last 30 days)
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

Answers (0)

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!