diff --git a/doc/dynare.texi b/doc/dynare.texi index 4a2c7c9c4..bca432f02 100644 --- a/doc/dynare.texi +++ b/doc/dynare.texi @@ -77,8 +77,6 @@ @emph{Algorithms} @end macro - - @macro customhead{title} @iftex @sp 1 @@ -8510,7 +8508,34 @@ Tests if a @dates object follows another @dates object or is equal to this objec @end table -@noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}). +@noindent One can select an element, or some elements, in a @dates object as he would extract some elements from a vector in Matlab/Octave. Let @code{a = 1950Q1:1951Q1} be a @dates object, then @code{a(1)==1950Q1} returns @code{1}, @code{a(end)==1951Q1} returns @code{1} and @code{a(end-1:end)} selects the two last elements of @code{a} (by instantiating the @dates object @code{[1950Q4, 1951Q1]}). + +@remarkhead +@noindent Dynare substitues any occurence of dates in the mod file into an instantiation of the @dates class regardless of the context. For instance, @code{d = 1950Q1;} will be translated as @code{a = dates('1950Q1');}. This automatic substitution can lead to a crash if a date is defined in a string. Typically, if the user wants to display a date: + +@example +disp('Initial period is 1950Q1'); +@end example + +@noindent Dynare will translate this as: + +@example +disp('Initial period is dates('1950Q1')'); +@end example + +@noindent which will lead to a crash because this expression is illegal in Matlab. For this situation, Dynare provides the @code{$} escape parameter. The following expression: + +@example +disp('Initial period is $1950Q1'); +@end example + +@noindent will be translated as: + +@example +disp('Initial period is 1950Q1'); +@end example + +@noindent in the generated matlab script. @node dates class @subsection dates class