read only numbers from mixed cells in excel
1 次查看(过去 30 天)
显示 更早的评论
i want to read the following coloum:
9:28:53.321 AM
9:28:53.421 AM
9:28:53.521 AM
but without the AM. thanks
0 个评论
回答(1 个)
Star Strider
2017-5-13
Read it with the ‘AM’ and ‘PM’, then use the datenum or datetime functions to make the appropriate time-of-day conversions to 24-hour time.
Please never discard useful information!
2 个评论
Star Strider
2017-5-13
You can get them in the same format by first using the ‘AM’ and ‘PM’ to be certain the times get imported and converted correctly. You can then use whatever format you want for the output. For ‘AM’ times, the hours will be unchanged, for ‘PM’ times, 1 PM will become 13, for example.
There are many possible output formats from the date and time functions. You do not need to specify ‘AM’ and ‘PM’ in the output unless you want to.
另请参阅
类别
在 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!