【发布时间】:2017-05-22 00:51:31
【问题描述】:
我已将以下 .xlsx 文件导入 Matlab:
我的代码:
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
出现以下错误信息:
Undefined function 'sum' for input arguments of type 'cell'.
我想让 Matlab 将所有“NaN”都视为 NaN,这样我就可以执行计算。 我已经尝试过的方法:将 Excel 中的 NaN 替换为空格,然后在 Matlab > 导入数据 > “用 NaN 替换空格” > 不工作,仍然显示字符串格式
【问题讨论】: