How do I convert a datetime array to a cell array of strings?
40 次查看(过去 30 天)
显示 更早的评论
MathWorks Support Team
2019-12-17
回答: MathWorks Support Team
2020-3-2
I have an array of datetimes. How do I convert this to a cell array of strings or character vectors?
采纳的回答
MathWorks Support Team
2019-12-17
The best way to convert a datetime array to a cell array is to use the "cellstr" function:
For example,
>> DateStrings = {'2014-05-26';'2014-08-03'};
>> t = datetime(DateStrings,'InputFormat','yyyy-MM-dd')
>> t_cell = cellstr(t)
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!