How to let Matlab know 'NaN' should be treated as NaN?
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!