Code covered by the BSD License  

Highlights from
mydate

Be the first to rate this file! 20 Downloads (last 30 days) File Size: 30.1 KB File ID: #31065

mydate

by Felipe G. Nievinski

 

16 Apr 2011 (Updated 19 Nov 2012)

Augments MATLAB's date/time library for improved handling of epochs and formats commonly used in GPS

| Watch this File

File Information
Description

Augments MATLAB's date/time library for improved handling of epochs and formats commonly used in GPS.
The base date or reference epoch is brought closer to contemporary dates for improved precision (from MATLAB's year 0 to epoch 2000.0); the base unit is also changed (from multiples of days to seconds).
Epoch values are retained as a serial scalar real number so that manipulation is easier compared to handling epoch parts separately (e.g., using intersect() to find common epochs).
File naming follows MATLAB's own as close as possible with an obvious prefix. MATLAB's own functions are used internally whenever possible.
Vector (non-scalar) input is supported.

Unzip the file into, e.g., 'c:\work\fx\mydate\'; make sure the directory structure is preserved. Then type
    addpath(genpath('c:\work\fx\mydate'))
(not to be confused with addpath(genpath('c:\work\fx\mydate\mydate')))
Please run test_mydate to check your installation.
The first function to try is mydatenum().

Julian day conversions follow from Peter Baum's excellent "Date algorithms", available at http://mysite.verizon.net/aesir_research/date/date0.htm

Please type doc datenum for background.

mydatenum: convert from vector format (year, month, day, hour, min, sec)
mydatevec: convert to vector format

mydatebod: beginning of day
mydatedoy: to day of year
mydatedoyi: from day of year
mydategps: to second of week, day of week, and GPS week number
mydatehour: to hours
mydatejd: to Julian day number
mydatejdi: from Julian day number
mydatemjd: to modified Julian day number
mydatemjdi: from modified Julian day number
mydatesec: to seconds
mydateseci: from seconds
mydatesod: to seconds of the day (day of that epoch or arbitrary day)
mydatesodi: from seconds of the day
mydatesow: to seconds of the week
mydatesowi: from seconds of the week
mydatestd: to standardized annual epoch (as in, e.g., monthly climatology)
mydatestdi: from standardized annual epoch
mydatestr: to text string
mydatestri: from text string
mydateyear: to year number

Acknowledgements

Testit inspired this file.

MATLAB release MATLAB 7.9 (R2009b)
Tags for This File  
Everyone's Tags
calendar, date, doy, epoch, gps, julian, second, time, week
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Updates
19 Nov 2012

some default values for optional input arguments

Contact us