Hello! I would like your help on my issue.
I have an excel file (see attached) that contains daily pollution data from 2006-2016. For the columns B to H I would like to find NaN values for each column, sum them, and in the end, store all these in a new table.
So far I have done this for column B:
[ii jj] = find(isnan(MoT20062016S1.SO2gm3));
outij = sortrows([ii jj]);
length(outij)
How can I expand outij to include columns C to H?
Thanks in advance!
PS. I'm on R2019a

답변 (1개)

KSSV
KSSV 2021년 5월 24일

0 개 추천

A = [1 2 NaN 5 NaN] ;
idx = isnan(A) ;
A(idx)

댓글 수: 5

Daphne PARLIARI
Daphne PARLIARI 2021년 5월 24일
Thank you KSSV.
Your answer could only work for one column. I am interested in assessing all 7 columns (B to H) and store the results in the new table outij.
KSSV
KSSV 2021년 5월 24일
Run a loop for each column.
for i = 2:7
t = T.(i)
end
Daphne PARLIARI
Daphne PARLIARI 2021년 5월 24일
Could you please explain what those 3 lines do?
KSSV
KSSV 2021년 5월 24일
It is a loop, which picks each column of table depedning on the loop index.
Are you looking for nansum? Read about it.
Daphne PARLIARI
Daphne PARLIARI 2021년 5월 24일
Let me explain it this way:
Ideally, I want a table (see outij.xlsx attached) that will contain the 7 columns I want to assess, and each column will have saved the positions where a NaN was detected.
E.g. For SO2, the first NaN was detected at place 201 of the original table, the second NaN at position 202 etc.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Tables에 대해 자세히 알아보기

태그

질문:

2021년 5월 24일

댓글:

2021년 5월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by