Ismember as a condition?
이전 댓글 표시
Hello guys.
I am trying to achieve something easy I think, but I don't know the correct way.
I have two tables, let's say WRF and Obs, that contain hourly values of several variables. What I want to do is calculate things and produce graphs, for the dates that both tables have data.
Eg, WRF contains data from 1/7/2019 to 30/9/2019 and Obs from 31/3/2019 to 30/9/2019.
I tried
ismatch = ismember(Obs.Hourly_DATE, WRF.Date);
which returns 0s kai 1s. How do I take one step further and use the 1s to calculate the things I want?
Thank you in advance!
댓글 수: 4
Mohammad Sami
2020년 1월 30일
편집: Mohammad Sami
2020년 1월 30일
Are the timestamps in data exact match and equally spaced ?
If not I would suggest that you use timetable and combine the two timetables with the synchronize function.
newtable = innerjoin(Obs,WRF,'LeftKeys','Hourly_DATE','RightKeys','Date');
Daphne PARLIARI
2020년 1월 30일
Mohammad Sami
2020년 1월 30일
편집: Mohammad Sami
2020년 1월 30일
Ok the innerjoin should then correctly merge the two tables together on the common datetime values. Do verify the newtable created before using it further.
Daphne PARLIARI
2020년 1월 30일
편집: Daphne PARLIARI
2020년 1월 30일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!