You are now following this Submission
- You will see updates in your followed content feed
- You may receive emails, depending on your communication preferences
A very simple program to convert a time in seconds to a string giving the time in hours, minutes and seconds. Useful for producing readable toc output from programs which run for ages.
e.g.
help secs2hms
SECS2HMS - converts a time in seconds to a string giving the time in hours, minutes and second
Usage TIMESTRING = SECS2HMS(TIME)]);
Example 1: >> secs2hms(7261)
>> ans = 2 hours, 1 min, 1.0 sec
Example 2: >> tic; pause(61); disp(['program took ' secs2hms(toc)]);
>> program took 1 min, 1.0 secs
Cite As
Simon Robinson (2026). Seconds to hours, minutes, seconds (https://au.mathworks.com/matlabcentral/fileexchange/22817-seconds-to-hours-minutes-seconds), MATLAB Central File Exchange. Retrieved .
Acknowledgements
Inspired by: Tools for NIfTI and ANALYZE image
General Information
- Version 1.4.0.0 (1.48 KB)
MATLAB Release Compatibility
- Compatible with any release
Platform Compatibility
- Windows
- macOS
- Linux
