Home > utilities > Times2Datetime.m

Times2Datetime

PURPOSE ^

TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to

SYNOPSIS ^

function [ outputDTs ] = Times2Matlab( Times )

DESCRIPTION ^

TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to
a Matlab Datetime array. 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 Datetime objects, one for each timestep.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ outputDTs ] = Times2Matlab( Times )
0002 %TIMES2DATETIME Converts the 'Times' variable from a FVCOM output file to
0003 %a Matlab Datetime array. 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 Datetime objects, one for each timestep.
0007 
0008 % NB time zones are not considered.
0009 
0010 %   Simon Waldman / Marine Scotland Science 2018.
0011 
0012 assert(ischar(Times), 'Input should be a character array.');
0013 
0014 outputDTs = datetime( Times', 'InputFormat', 'yyyy-MM-dd''T''HH:mm:ss.SSSSSS'); 
0015 
0016 end
0017

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005