


TIMES2MATLAB Converts the 'Times' variable from a FVCOM output file to Matlab serial dates. This isn't gonna work if the FVCOM model isn't using Julian dates. Input: 'Times' variable, already read from a FVCOM netCDF output file. Output: Array of Matlab serial date numbers, one for each timestep.


0001 function [ sdTimes ] = Times2Matlab( Times ) 0002 %TIMES2MATLAB Converts the 'Times' variable from a FVCOM output file to 0003 %Matlab serial dates. This isn't gonna work if the FVCOM model isn't using 0004 % Julian dates. 0005 % Input: 'Times' variable, already read from a FVCOM netCDF output file. 0006 % Output: Array of Matlab serial date numbers, one for each timestep. 0007 0008 % Simon Waldman / Heriot-Watt University 2016. 0009 0010 sdTimes = datenum(Times(1:23,:)', 'yyyy-mm-ddTHH:MM:SS.FFF'); 0011 0012 % Note - FVCOM includes microseconds, but datenum doesn't recognise that 0013 % level of precision. To be correct I should round them, but instead I 0014 % truncate them because it's simple. If you care about +/- 1 millisecond in your model results, 0015 % don't use this function. 0016 0017 end 0018