Various optimizations and cosmetic changes.
parent
35645540e5
commit
b858aed1c0
|
@ -110,7 +110,7 @@ switch nargin
|
||||||
dd = subsref(dd,S);
|
dd = subsref(dd,S);
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
error(['dates::dates: Wrong calling sequence!'])
|
error('dates::dates: Wrong calling sequence!')
|
||||||
end
|
end
|
||||||
for i=2:dd.ndat
|
for i=2:dd.ndat
|
||||||
if isdate(varargin{i})
|
if isdate(varargin{i})
|
||||||
|
@ -118,10 +118,10 @@ switch nargin
|
||||||
if isequal(date.freq,dd.freq)
|
if isequal(date.freq,dd.freq)
|
||||||
dd.time(i,:) = date.time;
|
dd.time(i,:) = date.time;
|
||||||
else
|
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
|
end
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -93,7 +93,7 @@ switch S(1).type
|
||||||
elseif isequal(m,1)
|
elseif isequal(m,1)
|
||||||
B.time = [S(1).subs{2}, ones(n,1)];
|
B.time = [S(1).subs{2}, ones(n,1)];
|
||||||
else
|
else
|
||||||
error(['dates::subsref: This is a bug!'])
|
error('dates::subsref: This is a bug!')
|
||||||
end
|
end
|
||||||
B.ndat = rows(B.time);
|
B.ndat = rows(B.time);
|
||||||
elseif isequal(length(S(1).subs),3)
|
elseif isequal(length(S(1).subs),3)
|
||||||
|
@ -148,7 +148,7 @@ switch S(1).type
|
||||||
elseif isequal(m,1) && isequal(B.freq,1)
|
elseif isequal(m,1) && isequal(B.freq,1)
|
||||||
B.time = [S(1).subs{1}, ones(n,1)];
|
B.time = [S(1).subs{1}, ones(n,1)];
|
||||||
else
|
else
|
||||||
error(['dates::subsref: This is a bug!'])
|
error('dates::subsref: This is a bug!')
|
||||||
end
|
end
|
||||||
B.ndat = rows(B.time);
|
B.ndat = rows(B.time);
|
||||||
else
|
else
|
||||||
|
@ -267,7 +267,7 @@ end
|
||||||
%$
|
%$
|
||||||
%$ % Define a ranges of dates using qq.
|
%$ % Define a ranges of dates using qq.
|
||||||
%$ try
|
%$ try
|
||||||
%$ r1 = qq(1950,1):qq([1950, 3]);
|
%$ r1 = qq(1950,1):qq(1950,3);%qq([1950, 3]);
|
||||||
%$ t(1) = 1;
|
%$ t(1) = 1;
|
||||||
%$ catch
|
%$ catch
|
||||||
%$ t(1) = 0;
|
%$ t(1) = 0;
|
||||||
|
|
|
@ -25,11 +25,11 @@ function b = isdate(str) % --*-- Unitary tests --*--
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% 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);
|
b = isquaterly(str) || isyearly(str) || ismonthly(str) || isweekly(str);
|
||||||
else
|
%else
|
||||||
b = 0;
|
%b = 0;
|
||||||
end
|
%end
|
||||||
|
|
||||||
%@test:1
|
%@test:1
|
||||||
%$
|
%$
|
||||||
|
|
|
@ -26,7 +26,11 @@ function b = ismonthly(str) % --*-- Unitary tests --*--
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if ischar(str)
|
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
|
else
|
||||||
b = 0;
|
b = 0;
|
||||||
end
|
end
|
||||||
|
|
|
@ -25,8 +25,12 @@ function b = isquaterly(str) % --*-- Unitary tests --*--
|
||||||
% You should have received a copy of the GNU General Public License
|
% You should have received a copy of the GNU General Public License
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if ischar(str)
|
if ischar(str)
|
||||||
b = ~isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$'));
|
if isempty(regexp(str,'^-?[0-9]*[Qq][1-4]$','once'))
|
||||||
|
b = 0;
|
||||||
|
else
|
||||||
|
b = 1;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
b = 0;
|
b = 0;
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,11 @@ function b = isweekly(str) % --*-- Unitary tests --*--
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if ischar(str)
|
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
|
else
|
||||||
b = 0;
|
b = 0;
|
||||||
end
|
end
|
||||||
|
|
|
@ -26,7 +26,11 @@ function b = isyearly(str) % --*-- Unitary tests --*--
|
||||||
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
if ischar(str)
|
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
|
else
|
||||||
b = 0;
|
b = 0;
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue