Skip to content
Snippets Groups Projects
Commit bd9414ae authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added two methods returning year and subperiod.

parent da07ab37
No related branches found
No related tags found
No related merge requests found
function s = year(d)
% Returns the subperiod (quarter, month or week depending on the frequency).
% Copyright (C) 2016 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare dates submodule is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
s = d.time(2);
\ No newline at end of file
...@@ -36,7 +36,7 @@ switch S(1).type ...@@ -36,7 +36,7 @@ switch S(1).type
error(['dates::subsref: ' S(1).subs ' is not a method but a member!']) error(['dates::subsref: ' S(1).subs ' is not a method but a member!'])
end end
B = builtin('subsref', A, S(1)); B = builtin('subsref', A, S(1));
case {'sort','sort_','unique','unique_','double','isempty','length','char','ndat'}% Public methods (without input arguments) case {'sort','sort_','unique','unique_','double','isempty','length','char','ndat','year','subperiod'}% Public methods (without input arguments)
B = feval(S(1).subs,A); B = feval(S(1).subs,A);
if length(S)>1 && isequal(S(2).type,'()') && isempty(S(2).subs) if length(S)>1 && isequal(S(2).type,'()') && isempty(S(2).subs)
S = shiftS(S,1); S = shiftS(S,1);
......
function y = year(d)
% Returns the year.
% Copyright (C) 2016 Dynare Team
%
% This code is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare dates submodule is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
y = d.time(1);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment