round_datenum

Rounds matlab datenum time to a multiple value of a time unit.

You are now following this Submission

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 .

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0