diff --git a/matlab/@dates/dates.m b/matlab/@dates/dates.m index 5df103424..c442b4bb2 100644 --- a/matlab/@dates/dates.m +++ b/matlab/@dates/dates.m @@ -110,7 +110,7 @@ switch nargin dd = subsref(dd,S); return else - error(['dates::dates: Wrong calling sequence!']) + error('dates::dates: Wrong calling sequence!') end for i=2:dd.ndat if isdate(varargin{i}) @@ -118,10 +118,10 @@ switch nargin if isequal(date.freq,dd.freq) dd.time(i,:) = date.time; else - error(['dates::dates: Check that all the inputs have the same frequency (see input number ' str2num(i) ')!']) + error(sprintf('dates::dates: Check that all the inputs have the same frequency (see input number %i)!',i)) end else - error(['dates::dates: Input ' str2num(i) ' has to be a string date!']) + error(sprintf('dates::dates: Input %i has to be a string date!',i)) end end end diff --git a/matlab/@dates/subsref.m b/matlab/@dates/subsref.m index 0cd0cd401..e966fc1e9 100644 --- a/matlab/@dates/subsref.m +++ b/matlab/@dates/subsref.m @@ -93,7 +93,7 @@ switch S(1).type elseif isequal(m,1) B.time = [S(1).subs{2}, ones(n,1)]; else - error(['dates::subsref: This is a bug!']) + error('dates::subsref: This is a bug!') end B.ndat = rows(B.time); elseif isequal(length(S(1).subs),3) @@ -148,7 +148,7 @@ switch S(1).type elseif isequal(m,1) && isequal(B.freq,1) B.time = [S(1).subs{1}, ones(n,1)]; else - error(['dates::subsref: This is a bug!']) + error('dates::subsref: This is a bug!') end B.ndat = rows(B.time); else @@ -267,7 +267,7 @@ end %$ %$ % Define a ranges of dates using qq. %$ try -%$ r1 = qq(1950,1):qq([1950, 3]); +%$ r1 = qq(1950,1):qq(1950,3);%qq([1950, 3]); %$ t(1) = 1; %$ catch %$ t(1) = 0; diff --git a/matlab/utilities/dates/isdate.m b/matlab/utilities/dates/isdate.m index ebcd2816e..2fb603803 100644 --- a/matlab/utilities/dates/isdate.m +++ b/matlab/utilities/dates/isdate.m @@ -25,11 +25,11 @@ function b = isdate(str) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if length(str)>1 +%if length(str)>1 b = isquaterly(str) || isyearly(str) || ismonthly(str) || isweekly(str); -else - b = 0; -end + %else + %b = 0; + %end %@test:1 %$ diff --git a/matlab/utilities/dates/ismonthly.m b/matlab/utilities/dates/ismonthly.m index 7d3a60f65..a66d06e69 100644 --- a/matlab/utilities/dates/ismonthly.m +++ b/matlab/utilities/dates/ismonthly.m @@ -26,7 +26,11 @@ function b = ismonthly(str) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ischar(str) - b = ~isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$')); + if isempty(regexp(str,'^-?[0-9]*[Mm]([1-9]|1[0-2])$','once')) + b = 0; + else + b = 1; + end else b = 0; end diff --git a/matlab/utilities/dates/isquaterly.m b/matlab/utilities/dates/isquaterly.m index 92b1c6dc2..2b154ef3c 100644 --- a/matlab/utilities/dates/isquaterly.m +++ b/matlab/utilities/dates/isquaterly.m @@ -25,8 +25,12 @@ function b = isquaterly(str) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if ischar(str) - b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$')); +if ischar(str) + if isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$','once')) + b = 0; + else + b = 1; + end else b = 0; end diff --git a/matlab/utilities/dates/isweekly.m b/matlab/utilities/dates/isweekly.m index ea7eca992..d9988f525 100644 --- a/matlab/utilities/dates/isweekly.m +++ b/matlab/utilities/dates/isweekly.m @@ -26,7 +26,11 @@ function b = isweekly(str) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ischar(str) - b = ~isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$')); + if isempty(regexp(str,'^-?[0-9]*[Ww]([1-9]|[1-4][0-9]|5[0-2])$','once')) + b = 0; + else + b = 1; + end else b = 0; end diff --git a/matlab/utilities/dates/isyearly.m b/matlab/utilities/dates/isyearly.m index ef56c46b9..d1345a0a1 100644 --- a/matlab/utilities/dates/isyearly.m +++ b/matlab/utilities/dates/isyearly.m @@ -26,7 +26,11 @@ function b = isyearly(str) % --*-- Unitary tests --*-- % along with Dynare. If not, see . if ischar(str) - b = ~isempty(regexp(str,'^-?[0-9]*[YyAa]$')); + if isempty(regexp(str,'^-?[0-9]*[YyAa]$','once')) + b = 0; + else + b = 1; + end else b = 0; end