How convert cell array inside a cell array in a string with date and time format ?
1 次查看(过去 30 天)
显示 更早的评论
I've use this code to take a string like this: Daily_cum_2013_05_30_09_59__2013_05_31_10_05.asc and split it in two columns with only the numeric format (this a date and time).
sC = regexp(F, 'Daily_cum_', 'split');
sC = vertcat(sC{:});
sC(:, 1) = [];
sC = regexp(sC, '\.asc', 'split');
sC = vertcat(sC{:});
sC = regexp(sC, '__', 'split');
sC = sC(:,1);
Now I've a cells (4000x1) with inside a another cells (1x2).
How I can split this cells inside a string e convert to data and time format ?
Thanks
Stefano
0 个评论
采纳的回答
Azzi Abdelmalek
2016-2-11
F='Daily_cum_2013_05_30_09_59__2013_05_31_10_05__2013_05_31_10_08'
a=F(11:end)
b=regexp(a,'__','split')
out1=cellfun(@(x) datestr(datenum(x(1:10),'yyyy_mm_dd'),'yyyy/mm/dd'),b,'un',0)
out2=cellfun(@(x) datestr(datenum(x(12:end),'HH_MM'),'HH:MM'),b,'un',0)
out=[out1' out2']
4 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cell Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!