Create a numeric variable with date+hour
2 次查看(过去 30 天)
显示 更早的评论
Hi. I have a problem when I want to create a numeric variable which contains date + hour. This is my data:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/516582/image.png)
So... I want to obtain a number with the sumatory by rows (both columns are strings). Can you help me?
Thanks!
MATLAB VERSION: R19b
采纳的回答
Steven Lord
2021-2-11
How are you planning to use this "numeric variable with date+hour"? It's quite likely that you can achieve your goal with a datetime array.
dateAndTime = ["19/11/19", "05:16:41"; "19/11/19", "05:19:03"; "19/11/19", "05:21:26"]
dATWithSpace = join(dateAndTime, " ")
dt = datetime(dATWithSpace, 'InputFormat', 'dd/MM/yy hh:mm:ss')
For example, you can plot with it.
plot(dt, [1 4 9], 'o-')
更多回答(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!