change time format to seconds

2 ビュー (過去 30 日間)
asad ali
asad ali 2019 年 6 月 29 日
回答済み: Walter Roberson 2019 年 6 月 29 日
i have an excel file which i cant share
i am getting time array (char cells) in this format
00:00:00/00
.
.
.
01:36:45/345
"HH:MM:SS/sampling rate"
when i extract data from my excel file
i want to convert every cell of time array in to seconds
can any body help?

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 6 月 29 日
regexprep(YourCell, '/.*$','')
If you have a recent enough matlab then duration() can convert the character vectors. With older matlab you would want to split into components and convert them into numeric and duration() those; or you could datetime() and then subtract off the beginning of the day to convert to duration

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by