How to extract year and month from attached string.
4 次查看(过去 30 天)
显示 更早的评论
I want to extract year and month from attached string data. Please help me.
Thank you so much in advance.
Regard's
Varunesh
0 个评论
采纳的回答
madhan ravi
2019-1-10
编辑:madhan ravi
2019-1-10
load('date.mat');
a=date{:,:};
b=regexp(a,'\T','split');
b=[b{:}];
B=datetime(b(1:2:end).','InputFormat','yyyy-MM-dd');
[year,month,day]=ymd(B);
3 个评论
更多回答(1 个)
Walter Roberson
2019-1-10
times = datetime(date.datetime, 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss');
By the way, your times are not completely sorted.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Time Series Objects 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!