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

1 回表示 (過去 30 日間)
John
John 2017 年 1 月 7 日
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 Center および File ExchangeData Import from MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by