Select table data by Date
2 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a table, where the frist column is the date, and second column is a variable.
''2021-Jan-04'' -0.1581
''2021-Jan-04'' 0.0692
''2021-Jan-04'' 0
''2021-Jan-05'' -0.5150
''2021-Jan-05'' 0.2119
How can I select data in the second columb, by the date in the first colume?
Any help would be appreciated!
Inna
0 件のコメント
採用された回答
C B
2021 年 10 月 28 日
編集済み: C B
2021 年 10 月 28 日
dates = [datetime('today'); datetime('Yesterday') ;datetime('tomorrow')];
data = [-0.1 ; 0 ;0.1];
T = table(dates,data)
FindDate = '27-Oct-2021';
[val,index] = min(abs((datenum(T.dates)-datenum(FindDate))));
T.data(index)
FindDate = '29-Oct-2021';
[val,index] = min(abs((datenum(T.dates)-datenum(FindDate))));
T.data(index)
FindDate = '28-Oct-2021';
[val,index] = min(abs((datenum(T.dates)-datenum(FindDate))));
T.data(index)
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calendar についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!