round_datenum
Version 1.0.0 (1.88 KB) by
Alexander Andriatis
Rounds matlab datenum time to a multiple value of a time unit.
Rounds matlab datenum time to a multiple value of a time unit.
Have you ever wanted to grid a dataset on, say, a 15 minute grid, and want the time to start at the nearest 15 minute interval from the top of the hour? This is the script for you!
For time = datenum(2023,11,10,18,23,47), round_datenum(time,'minute',15,'ceil') returns datenum(2023,11,10,18,30,00)
Handles rounding year, month, day in year, hour, minute, and second
Can specify to round to the nearest value, or in a set direction
Only workes for single datenum time inputs
Cite As
Alexander Andriatis (2026). round_datenum (https://www.mathworks.com/matlabcentral/fileexchange/154890-round_datenum), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R2023b
Compatible with any release
Platform Compatibility
Windows macOS LinuxTags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.0.0 |
