How to let Matlab know 'NaN' should be treated as NaN?
조회 수: 1 (최근 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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!