diff --git a/matlab/@dates/dates.m b/matlab/@dates/dates.m index 5df103424a6798a10a6232564a0c2c58a229caac..c442b4bb2b1e0946104dc0a808396487f3b556be 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 0cd0cd4014cc69be9c6a2d3d160ae21f24ae23f8..e966fc1e958e65bbe3ae23fe937453a3002cb3f9 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 ebcd2816e49c9ce8cddd0f44bd1887993f8a59ac..2fb6038030229279d07b4575aaee57475b63d4dc 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 <http://www.gnu.org/licenses/>. -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 7d3a60f652cd1fbe27bcf0eafa6350dc0e65abd1..a66d06e695f1f411ad09127f14a767d20caaa178 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 <http://www.gnu.org/licenses/>. 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 92b1c6dc274171b235453729fd41b06d90ebefb8..2b154ef3c5f403a296b5c95c00ef79b8202862f1 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 <http://www.gnu.org/licenses/>. -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 ea7eca99268a5cdf87fc2b8b8ad5ff7dafaba839..d9988f5253bd865d83d04e8cb18e59a441fd836a 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 <http://www.gnu.org/licenses/>. 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 ef56c46b9e7a520bcd41987abd2fa1e2986780fd..d1345a0a185eed4ea79ccfe69d7ca9d1239a5231 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 <http://www.gnu.org/licenses/>. 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