Round, Ceil and Floor Matlab-datenumbers

round/ceil/floor Matlab datenumbers to the nearest N or multiple N of a time_unit

Download
Download

You are now following this Submission

Cite As

Oscar Hartogensis (2026). Round, Ceil and Floor Matlab-datenumbers (https://ch.mathworks.com/matlabcentral/fileexchange/38167-round-ceil-and-floor-matlab-datenumbers), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: round2

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

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

For very long datenumber-records datenumRound2_OH would give an "out of memory" error. This had to do with the unnecessary usage of diag.m, which is now replaced with a more memory friendly solution.

Download
1.3.0

* Added do_one option: for time_units that count from 1 instead of 0 (i.e. 'DD',DOY' and 'MO') take N as incremental summation starting at 1
* Some small bug-fixes

Download
1.2.0

solved a rounding error in intermediate time_variables that caused e.g. datestr(datenumFloor2_OH(datenum(2012,1,28,16,0,0),'HH',2,1)) to give 28-Jan-2012 14:00:00 instead of 16:00

Download
1.1.0

Added acknowledgement to round2

Download
1.0.0

Download