diff --git a/matlab/utilities/dates/ismonthly.m b/matlab/utilities/dates/ismonthly.m
index 28c9e0cfe..54b77a22d 100644
--- a/matlab/utilities/dates/ismonthly.m
+++ b/matlab/utilities/dates/ismonthly.m
@@ -1,6 +1,14 @@
-function b = ismonthly(date)
+function b = ismonthly(str) % --*-- Unitary tests --*--
-% Copyright (C) 2012 Dynare Team
+% Tests if the input can be interpreted as a monthly date.
+%
+% INPUTS
+% o str string.
+%
+% OUTPUTS
+% o b integer scalar, equal to 1 if str can be interpreted as a monthly date or 0 otherwise.
+
+% Copyright (C) 2012-2013 Dynare Team
%
% This file is part of Dynare.
%
@@ -17,21 +25,26 @@ function b = ismonthly(date)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
+b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[12])$'));
-[year, remain] = strtok(date,'M');
-if ~isint(str2num(year))
- b = 0;
- return
-end
-[month, remain] = strtok(remain,'M');
-if ~isempty(remain)
- b = 0;
- return
-end
-month = str2num(month);
-if ~isint(month) || month<1 || month>12
- b = 0;
- return
-end
-b = 1;
\ No newline at end of file
+%@test:1
+%$
+%$ date_1 = '1950M2';
+%$ date_2 = '1950m2';
+%$ date_3 = '-1950m2';
+%$ date_4 = '1950m12';
+%$ date_5 = '1950 azd ';
+%$ date_6 = '1950Y';
+%$ date_7 = '1950Q3';
+%$ date_8 = '1950m24';
+%$
+%$ t(1) = dyn_assert(ismonthly(date_1),1);
+%$ t(2) = dyn_assert(ismonthly(date_2),1);
+%$ t(3) = dyn_assert(ismonthly(date_3),1);
+%$ t(4) = dyn_assert(ismonthly(date_4),1);
+%$ t(5) = dyn_assert(ismonthly(date_5),0);
+%$ t(6) = dyn_assert(ismonthly(date_6),0);
+%$ t(7) = dyn_assert(ismonthly(date_7),0);
+%$ t(8) = dyn_assert(ismonthly(date_8),0);
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/matlab/utilities/dates/isquaterly.m b/matlab/utilities/dates/isquaterly.m
index 9310435da..223859b59 100644
--- a/matlab/utilities/dates/isquaterly.m
+++ b/matlab/utilities/dates/isquaterly.m
@@ -1,6 +1,14 @@
-function b = isquaterly(date)
-
-% Copyright (C) 2012 Dynare Team
+function b = isquaterly(str) % --*-- Unitary tests --*--
+
+% Tests if the input can be interpreted as a quaterly date.
+%
+% INPUTS
+% o str string.
+%
+% OUTPUTS
+% o b integer scalar, equal to 1 if str can be interpreted as a quaterly date or 0 otherwise.
+
+% Copyright (C) 2012-2013 Dynare Team
%
% This file is part of Dynare.
%
@@ -17,21 +25,24 @@ function b = isquaterly(date)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
+b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
-[year, remain] = strtok(date,'Q');
-if ~isint(str2num(year))
- b = 0;
- return
-end
-[quarter, remain] = strtok(remain,'Q');
-if ~isempty(remain)
- b = 0;
- return
-end
-quarter = str2num(quarter);
-if ~isint(quarter) || quarter<1 || quarter>4
- b = 0;
- return
-end
-b = 1;
\ No newline at end of file
+%@test:1
+%$
+%$ date_1 = '1950Q2';
+%$ date_2 = '1950q2';
+%$ date_3 = '-1950q2';
+%$ date_4 = '1950q12';
+%$ date_5 = '1950 azd ';
+%$ date_6 = '1950Y';
+%$ date_7 = '1950m24';
+%$
+%$ t(1) = dyn_assert(isquaterly(date_1),1);
+%$ t(2) = dyn_assert(isquaterly(date_2),1);
+%$ t(3) = dyn_assert(isquaterly(date_3),1);
+%$ t(4) = dyn_assert(isquaterly(date_4),0);
+%$ t(5) = dyn_assert(isquaterly(date_5),0);
+%$ t(6) = dyn_assert(isquaterly(date_6),0);
+%$ t(7) = dyn_assert(isquaterly(date_7),0);
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/matlab/utilities/dates/isweekly.m b/matlab/utilities/dates/isweekly.m
index 266bd4958..550c463d5 100644
--- a/matlab/utilities/dates/isweekly.m
+++ b/matlab/utilities/dates/isweekly.m
@@ -1,6 +1,14 @@
-function b = isweekly(date)
+function b = isweekly(str) % --*-- Unitary tests --*--
-% Copyright (C) 2012 Dynare Team
+% Tests if the input can be interpreted as a weekly date.
+%
+% INPUTS
+% o str string.
+%
+% OUTPUTS
+% o b integer scalar, equal to 1 if str can be interpreted as a weekly date or 0 otherwise.
+
+% Copyright (C) 2012-2013 Dynare Team
%
% This file is part of Dynare.
%
@@ -17,21 +25,26 @@ function b = isweekly(date)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
+b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
-[year, remain] = strtok(date,'W');
-if ~isint(str2num(year))
- b = 0;
- return
-end
-[week, remain] = strtok(remain,'W');
-if ~isempty(remain)
- b = 0;
- return
-end
-week = str2num(week);
-if ~isint(week) || week<1 || week>52
- b = 0;
- return
-end
-b = 1;
\ No newline at end of file
+%@test:1
+%$
+%$ date_1 = '1950W2';
+%$ date_2 = '1950w2';
+%$ date_3 = '-1950w2';
+%$ date_4 = '1950w22';
+%$ date_5 = '1950 azd ';
+%$ date_6 = '1950Y';
+%$ date_7 = '1950Q3';
+%$ date_8 = '1950m54';
+%$
+%$ t(1) = dyn_assert(isweekly(date_1),1);
+%$ t(2) = dyn_assert(isweekly(date_2),1);
+%$ t(3) = dyn_assert(isweekly(date_3),1);
+%$ t(4) = dyn_assert(isweekly(date_4),1);
+%$ t(5) = dyn_assert(isweekly(date_5),0);
+%$ t(6) = dyn_assert(isweekly(date_6),0);
+%$ t(7) = dyn_assert(isweekly(date_7),0);
+%$ t(8) = dyn_assert(isweekly(date_8),0);
+%$ T = all(t);
+%@eof:1
\ No newline at end of file
diff --git a/matlab/utilities/dates/isyearly.m b/matlab/utilities/dates/isyearly.m
index defe5901c..1af8d778b 100644
--- a/matlab/utilities/dates/isyearly.m
+++ b/matlab/utilities/dates/isyearly.m
@@ -1,6 +1,14 @@
-function b = isyearly(date)
+function b = isyearly(str) % --*-- Unitary tests --*--
-% Copyright (C) 2012 Dynare Team
+% Tests if the input can be interpreted as a yearly date.
+%
+% INPUTS
+% o str string.
+%
+% OUTPUTS
+% o b integer scalar, equal to 1 if str can be interpreted as a yearly date or 0 otherwise.
+
+% Copyright (C) 2012-2013 Dynare Team
%
% This file is part of Dynare.
%
@@ -17,25 +25,26 @@ function b = isyearly(date)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-% AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT fr
+b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
-year = str2num(date);
-if ~isempty(year)
- if isint(year)
- b = 1;
- else
- b = 0;
- end
- return
-else
- [year, remain] = strtok(date,'Y');
- if ~isequal(remain,'Y')
- b = 0;
- return
- end
- if ~isint(str2num(year))
- b = 0;
- return
- end
- b = 2;
-end
\ No newline at end of file
+%@test:1
+%$
+%$ date_1 = '1950M2';
+%$ date_2 = '1950m2';
+%$ date_3 = '-1950m2';
+%$ date_4 = '1950m12';
+%$ date_5 = '1950 azd ';
+%$ date_6 = '1950Y';
+%$ date_7 = '-1950a';
+%$ date_8 = '1950m24';
+%$
+%$ t(1) = dyn_assert(isyearly(date_1),0);
+%$ t(2) = dyn_assert(isyearly(date_2),0);
+%$ t(3) = dyn_assert(isyearly(date_3),0);
+%$ t(4) = dyn_assert(isyearly(date_4),0);
+%$ t(5) = dyn_assert(isyearly(date_5),0);
+%$ t(6) = dyn_assert(isyearly(date_6),1);
+%$ t(7) = dyn_assert(isyearly(date_7),1);
+%$ t(8) = dyn_assert(isyearly(date_8),0);
+%$ T = all(t);
+%@eof:1
\ No newline at end of file