Ismember as a condition?
3 ビュー (過去 30 日間)
古いコメントを表示
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 日
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.
採用された回答
Mohammad Sami
2020 年 1 月 30 日
Yes needed to combine with the time column.
load Obs.mat
load WRF.mat
WRF_Data.Date = WRF_Data.Date + duration(hour(WRF_Data.Time),minute(WRF_Data.Time),0)
Obs_Data.Hourly_DATE + duration(string(Obs_Data.Time),'InputFormat','hh:mm');
newtable = innerjoin(Obs_Data,WRF_Data,'LeftKeys','Hourly_DATE','RightKeys','Date');
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Live Scripts and Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!