For hours:minutes:secondes.hundredth for only seconds
Show older comments
Hello everybody, I have a problem in Matlab and I am not able to deal with what we have in the Mathworks site. Just look. I have an array of two columns, the first column have time data in this format 00: 00: 00.0 and I need my values are second, just 0.0s. Do you have any idea how I can solve this problem? Any help will be appreciated.
Answers (1)
Walter Roberson
on 27 Jul 2015
Edited: Walter Roberson
on 27 Jul 2015
Assuming that what you have is a cell array of strings:
regexprep(YourArray(:,1), '.*: *', '')
if you want the decimal form of the strings, then str2double() the result of that expression.
2 Comments
Vitor
on 27 Jul 2015
Walter Roberson
on 27 Jul 2015
dv = datevec(YourArray(:,1));
dv(:,4)*60*60 + dv(:,5)*60 + dv(:,6)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!