diff --git a/matlab/utilities/dates/ismonthly.m b/matlab/utilities/dates/ismonthly.m
index dd028706b..7d3a60f65 100644
--- a/matlab/utilities/dates/ismonthly.m
+++ b/matlab/utilities/dates/ismonthly.m
@@ -25,7 +25,11 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
+if ischar(str)
+ b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$'));
+else
+ b = 0;
+end
%@test:1
%$
diff --git a/matlab/utilities/dates/isquaterly.m b/matlab/utilities/dates/isquaterly.m
index 223859b59..92b1c6dc2 100644
--- a/matlab/utilities/dates/isquaterly.m
+++ b/matlab/utilities/dates/isquaterly.m
@@ -25,7 +25,11 @@ function b = isquaterly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
+if ischar(str)
+ b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
+else
+ b = 0;
+end
%@test:1
%$
diff --git a/matlab/utilities/dates/isweekly.m b/matlab/utilities/dates/isweekly.m
index 550c463d5..ea7eca992 100644
--- a/matlab/utilities/dates/isweekly.m
+++ b/matlab/utilities/dates/isweekly.m
@@ -25,7 +25,11 @@ function b = isweekly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
+if ischar(str)
+ b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$'));
+else
+ b = 0;
+end
%@test:1
%$
diff --git a/matlab/utilities/dates/isyearly.m b/matlab/utilities/dates/isyearly.m
index 1af8d778b..ef56c46b9 100644
--- a/matlab/utilities/dates/isyearly.m
+++ b/matlab/utilities/dates/isyearly.m
@@ -25,7 +25,11 @@ function b = isyearly(str) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see .
-b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
+if ischar(str)
+ b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$'));
+else
+ b = 0;
+end
%@test:1
%$