

    \filetitle{ww2day}{Convert weekly IRIS serial date number to Matlab serial date number}{dates/ww2day}

	\paragraph{Syntax}

\begin{verbatim}
Day = ww2day(Dat)
Day = ww2day(Dat,WDay)
\end{verbatim}

\paragraph{Input arguments}

\begin{itemize}
\item
  \texttt{Dat} {[} numeric {]} - IRIS serial number for weekly date.
\item
  \texttt{WDay} {[} \texttt{'Mon'} \textbar{} \texttt{'Tue'} \textbar{}
  \texttt{'Wed'} \textbar{} \texttt{'Thu'} \textbar{} \texttt{'Fri'}
  \textbar{} \texttt{'Sat'} \textbar{} \texttt{'Sun'} {]} - The day of
  the week that will represent the input week, \texttt{Dat}; if omitted,
  the week will be represented by its Thursday.
\end{itemize}

\paragraph{Output arguments}

\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
  \texttt{Day} {[} numeric {]} - Matlab serial date number representing
  Thursday in that week.
\end{itemize}

\paragraph{Description}

\paragraph{Example}

The first week of the year 2009 starts on Monday, 29 December 2008 (it
is the first week of 2009 by ISO 8601 definition, because Thursday of
that week falls in 2009).

The following command returns the Thursday of that week (note that
\texttt{datestr} is a standard Matlab function, not an IRIS function),

\begin{verbatim}
firstWeek09 = ww(2009,1);
datestr( ww2day(firstWeek09) )
ans =
01-Jan-2009
\end{verbatim}

while this command returns the Monday of the same week,

\begin{verbatim}
datestr( ww2day(firstWeek09,'Monday') )
ans =
29-Dec-2008
\end{verbatim}


