reporting: @graph, @series, support syntax simplification
parent
aecd2a89ad
commit
430f7b538f
|
@ -0,0 +1,22 @@
|
||||||
|
function o = addSeries(o, varargin)
|
||||||
|
% function o = addSeries(o, varargin)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
o.seriesElements = o.seriesElements.addSeries(varargin{:});
|
||||||
|
end
|
|
@ -28,15 +28,11 @@ function o = createGraph(o)
|
||||||
% 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/>.
|
||||||
|
|
||||||
assert(~isempty(o.data));
|
|
||||||
|
|
||||||
if ~isempty(o.figname)
|
if ~isempty(o.figname)
|
||||||
warning('@graph.createGraph: will overwrite %s with new graph\n', ...
|
warning('@graph.createGraph: will overwrite %s with new graph\n', ...
|
||||||
o.figname);
|
o.figname);
|
||||||
end
|
end
|
||||||
|
|
||||||
%o = readConfig(o);
|
|
||||||
|
|
||||||
disp('creating plot..........');
|
disp('creating plot..........');
|
||||||
h = figure('visible','off');
|
h = figure('visible','off');
|
||||||
hold on;
|
hold on;
|
||||||
|
@ -45,25 +41,25 @@ if o.grid
|
||||||
grid on;
|
grid on;
|
||||||
set(gca, 'GridLineStyle', '--');
|
set(gca, 'GridLineStyle', '--');
|
||||||
end
|
end
|
||||||
%set(0, 'CurrentFigure',h);
|
|
||||||
%set(h, 'PaperPositionMode', 'auto');
|
|
||||||
%set(h, 'units', 'normalized', 'outerposition', [0 0 1 1]);
|
|
||||||
|
|
||||||
if isempty(o.seriestouse)
|
ne = o.seriesElements.numel();
|
||||||
ds = o.data;
|
dd = dynDates();
|
||||||
else
|
for i=1:ne
|
||||||
ds = o.data{o.seriestouse{:}};
|
ddt = o.seriesElements(i).getLine(o.xrange);
|
||||||
|
if isempty(dd)
|
||||||
|
dd = ddt;
|
||||||
|
continue
|
||||||
|
end
|
||||||
|
if ddt(1) < dd(1)
|
||||||
|
dd = union(ddt(1):dd(1), dd);
|
||||||
|
end
|
||||||
|
if ddt(ddt.ndat) > dd(dd.ndat)
|
||||||
|
dd = union(dd, dd(dd.ndat):ddt(ddt.ndat));
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if ~isempty(o.xrange)
|
x = 1:1:dd.ndat;
|
||||||
ds = ds(o.xrange);
|
xlabels = getDatesCellStringArray(dd);
|
||||||
end
|
|
||||||
data = ds.data;
|
|
||||||
|
|
||||||
x = 1:1:ds.nobs;
|
|
||||||
xlabels = getDatesCellStringArray(ds.time);
|
|
||||||
|
|
||||||
plot(x, data);
|
|
||||||
|
|
||||||
if ~isempty(o.yrange)
|
if ~isempty(o.yrange)
|
||||||
ylim(o.yrange);
|
ylim(o.yrange);
|
||||||
|
@ -87,7 +83,7 @@ set(gca,'XTick', x);
|
||||||
set(gca,'XTickLabel', xlabels);
|
set(gca,'XTickLabel', xlabels);
|
||||||
|
|
||||||
if o.legend
|
if o.legend
|
||||||
lh = legend(ds.name);
|
lh = legend(o.seriesElements.getNames());
|
||||||
set(lh, 'orientation', o.legend_orientation);
|
set(lh, 'orientation', o.legend_orientation);
|
||||||
set(lh, 'Location', o.legend_location);
|
set(lh, 'Location', o.legend_location);
|
||||||
set(lh, 'FontSize', o.legend_font_size);
|
set(lh, 'FontSize', o.legend_font_size);
|
||||||
|
|
|
@ -54,16 +54,6 @@ disp([name '.figname = ']);
|
||||||
disp(' ');
|
disp(' ');
|
||||||
disp([' ''' o.figname '''']);
|
disp([' ''' o.figname '''']);
|
||||||
|
|
||||||
disp(' ');
|
|
||||||
disp([name '.data = ']);
|
|
||||||
disp(' ');
|
|
||||||
display(o.data);
|
|
||||||
|
|
||||||
disp(' ');
|
|
||||||
disp([name '.seriestoplot = ']);
|
|
||||||
disp(' ');
|
|
||||||
disp(o.seriestoplot);
|
|
||||||
|
|
||||||
disp(' ');
|
disp(' ');
|
||||||
disp([name '.config = ']);
|
disp([name '.config = ']);
|
||||||
disp(' ');
|
disp(' ');
|
||||||
|
@ -78,4 +68,9 @@ disp(' ');
|
||||||
disp([name '.shade = ']);
|
disp([name '.shade = ']);
|
||||||
disp(' ');
|
disp(' ');
|
||||||
disp(o.shade);
|
disp(o.shade);
|
||||||
|
|
||||||
|
disp(' ');
|
||||||
|
disp([name '.seriesElements = ']);
|
||||||
|
disp(' ');
|
||||||
|
o.seriesElements.getSeriesElements()
|
||||||
end
|
end
|
|
@ -35,6 +35,8 @@ o = struct;
|
||||||
|
|
||||||
o.config = '';
|
o.config = '';
|
||||||
|
|
||||||
|
o.seriesElements = seriesElements();
|
||||||
|
|
||||||
o.title = '';
|
o.title = '';
|
||||||
o.ylabel = '';
|
o.ylabel = '';
|
||||||
o.xlabel = '';
|
o.xlabel = '';
|
||||||
|
@ -112,11 +114,26 @@ assert(isempty(o.yrange) || (isfloat(o.yrange) && length(o.yrange) == 2 && ...
|
||||||
o.yrange(1) < o.yrange(2)), ...
|
o.yrange(1) < o.yrange(2)), ...
|
||||||
['@graph.graph: yrange is specified an array with two float entries, ' ...
|
['@graph.graph: yrange is specified an array with two float entries, ' ...
|
||||||
'the lower bound and upper bound.']);
|
'the lower bound and upper bound.']);
|
||||||
assert(~isempty(o.data) && isa(o.data, 'dynSeries'), ['@graph.graph: must ' ...
|
assert(isempty(o.data) || isa(o.data, 'dynSeries'), ['@graph.graph: data must ' ...
|
||||||
'provide data as a dynSeries']);
|
'be a dynSeries']);
|
||||||
assert(isempty(o.seriestouse) || iscellstr(o.seriestouse), ['@graph.graph: ' ...
|
assert(isempty(o.seriestouse) || iscellstr(o.seriestouse), ['@graph.graph: ' ...
|
||||||
'series to use must be a cell array of string(s)']);
|
'series to use must be a cell array of string(s)']);
|
||||||
|
|
||||||
|
% using o.seriestouse, create series objects and put them in o.seriesElements
|
||||||
|
if ~isempty(o.data)
|
||||||
|
if isempty(o.seriestouse)
|
||||||
|
for i=1:o.data.vobs
|
||||||
|
o.seriesElements = o.seriesElements.addSeries('data', o.data{o.name{i}});
|
||||||
|
end
|
||||||
|
else
|
||||||
|
for i=1:length(o.seriestouse)
|
||||||
|
o.seriesElements = o.seriesElements.addSeries('data', o.data{o.seriestouse{i}});
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
o = rmfield(o, 'seriestouse');
|
||||||
|
o = rmfield(o, 'data');
|
||||||
|
|
||||||
% Create graph object
|
% Create graph object
|
||||||
o = class(o, 'graph');
|
o = class(o, 'graph');
|
||||||
end
|
end
|
|
@ -29,6 +29,10 @@ if length(S) > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
switch S.type
|
switch S.type
|
||||||
|
case '()'
|
||||||
|
index = S.subs{:};
|
||||||
|
assert(isnumeric(index));
|
||||||
|
B.seriesElements(index) = V;
|
||||||
case '.'
|
case '.'
|
||||||
switch S.subs
|
switch S.subs
|
||||||
case fieldnames(A)
|
case fieldnames(A)
|
||||||
|
|
|
@ -33,7 +33,9 @@ switch S(1).type
|
||||||
otherwise
|
otherwise
|
||||||
error(['@graph.subsref: unknown field or method: ' S(1).subs]);
|
error(['@graph.subsref: unknown field or method: ' S(1).subs]);
|
||||||
end
|
end
|
||||||
case {'()', '{}'}
|
case '()'
|
||||||
|
A = A.seriesElements.getSeriesElements(S(1).subs{:});
|
||||||
|
case '{}'
|
||||||
error(['@graph.subsref: ' S(1).type ' indexing not supported.']);
|
error(['@graph.subsref: ' S(1).type ' indexing not supported.']);
|
||||||
otherwise
|
otherwise
|
||||||
error('@graph.subsref: impossible case')
|
error('@graph.subsref: impossible case')
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
function o = element(o, index)
|
||||||
|
% function o = element(o, index)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
assert(isint(index));
|
||||||
|
o = o.elements(index);
|
||||||
|
end
|
|
@ -32,8 +32,15 @@ switch S.type
|
||||||
case '()'
|
case '()'
|
||||||
index = S.subs{:};
|
index = S.subs{:};
|
||||||
assert(isnumeric(index));
|
assert(isnumeric(index));
|
||||||
B(index) = V;
|
B.elements(index) = V;
|
||||||
|
case '.'
|
||||||
|
switch S.subs
|
||||||
|
case fieldnames(A)
|
||||||
|
B.(S.subs) = V;
|
||||||
|
otherwise
|
||||||
|
error(['@section.subsasgn: field ' S.subs 'does not exist']);
|
||||||
|
end
|
||||||
otherwise
|
otherwise
|
||||||
error('@section.subsasgn: syntax error')
|
error('@section.subsasgn: syntax error');
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -0,0 +1,23 @@
|
||||||
|
function s = getName(o)
|
||||||
|
%function s = getName(o)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
assert(~isempty(o.data) && numel(o.data) == 1);
|
||||||
|
s = o.data(1).name();
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
function o = addSeries(o, varargin)
|
||||||
|
% function o = addSeries(o, varargin)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
o.objArray = o.objArray.addObj(series(varargin{:}));
|
||||||
|
end
|
|
@ -0,0 +1,37 @@
|
||||||
|
function display(o)
|
||||||
|
%function display(o)
|
||||||
|
% Display a Elements object
|
||||||
|
%
|
||||||
|
% INPUTS
|
||||||
|
% none
|
||||||
|
%
|
||||||
|
% OUTPUTS
|
||||||
|
% none
|
||||||
|
%
|
||||||
|
% SPECIAL REQUIREMENTS
|
||||||
|
% none
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
name = 'report.page.section.elements.seriesElement';
|
||||||
|
|
||||||
|
disp(' ');
|
||||||
|
disp([name ' = ']);
|
||||||
|
disp(' ');
|
||||||
|
disp(getSeriesElements(o));
|
||||||
|
end
|
|
@ -0,0 +1,26 @@
|
||||||
|
function names = getNames(o, varargin)
|
||||||
|
% function names = getNames(o, varargin)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
se = o.objArray.getObjs(varargin{:});
|
||||||
|
names = {};
|
||||||
|
for i=1:length(se)
|
||||||
|
names(i) = se{i}.getName();
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
function o = getSeriesElements(o, varargin)
|
||||||
|
% function o = getSeriesElements(o, varargin)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
o = o.objArray.getObjs(varargin{:});
|
||||||
|
end
|
|
@ -0,0 +1,22 @@
|
||||||
|
function n = numel(o)
|
||||||
|
% function n = numel(o)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
n = o.objArray.numObjs();
|
||||||
|
end
|
|
@ -0,0 +1,42 @@
|
||||||
|
function o = seriesElements(varargin)
|
||||||
|
%function o = seriesElements(varargin)
|
||||||
|
% SeriesElements Class Constructor
|
||||||
|
%
|
||||||
|
% INPUTS
|
||||||
|
% Optional seriesElements object
|
||||||
|
%
|
||||||
|
% OUTPUTS
|
||||||
|
% seriesElements object
|
||||||
|
%
|
||||||
|
% SPECIAL REQUIREMENTS
|
||||||
|
% none
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
switch nargin
|
||||||
|
case 0
|
||||||
|
o = class(struct, 'seriesElements', objArray());
|
||||||
|
case 1
|
||||||
|
assert(isa(varargin{1}, 'seriesElements'), ...
|
||||||
|
['@seriesElements.seriesElements: with one arg, you must pass an seriesElements ' ...
|
||||||
|
'object or a char.']);
|
||||||
|
o = varargin{1};
|
||||||
|
otherwise
|
||||||
|
error('@seriesElements.seriesElements: invalid number of arguments');
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,39 @@
|
||||||
|
function B = subsasgn(A, S, V)
|
||||||
|
% function B = subsasgn(A, S, V)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
B = A;
|
||||||
|
if length(S) > 1
|
||||||
|
for i=1:(length(S)-1)
|
||||||
|
B = subsref(B, S(i));
|
||||||
|
end
|
||||||
|
B = subsasgn(B, S(end), V);
|
||||||
|
B = subsasgn(A, S(1:(end-1)), B);
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
switch S.type
|
||||||
|
case '()'
|
||||||
|
index = S.subs{:};
|
||||||
|
assert(isnumeric(index));
|
||||||
|
B.objArray(index) = V;
|
||||||
|
otherwise
|
||||||
|
error('@seriesElements.subsasign: syntax error');
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,48 @@
|
||||||
|
function A = subsref(A, S)
|
||||||
|
%function A = subsref(A, S)
|
||||||
|
|
||||||
|
% Copyright (C) 2013 Dynare Team
|
||||||
|
%
|
||||||
|
% This file is part of Dynare.
|
||||||
|
%
|
||||||
|
% Dynare 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 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/>.
|
||||||
|
|
||||||
|
switch S(1).type
|
||||||
|
case '.'
|
||||||
|
switch S(1).subs
|
||||||
|
case fieldnames(A)
|
||||||
|
A = A.(S(1).subs);
|
||||||
|
case methods(A)
|
||||||
|
if areParensNext(S)
|
||||||
|
A = feval(S(1).subs, A, S(2).subs{:});
|
||||||
|
S = shiftS(S);
|
||||||
|
else
|
||||||
|
A = feval(S(1).subs, A);
|
||||||
|
end
|
||||||
|
otherwise
|
||||||
|
error(['@seriesElements.subsref: unknown field or method: ' S(1).subs]);
|
||||||
|
end
|
||||||
|
case '()'
|
||||||
|
A = getSeriesElements(A, S(1).subs{:});
|
||||||
|
case '{}'
|
||||||
|
error(['@seriesElements.subsref: ' S(1).type ' indexing not supported.']);
|
||||||
|
otherwise
|
||||||
|
error('@seriesElements.subsref: impossible case');
|
||||||
|
end
|
||||||
|
|
||||||
|
S = shiftS(S);
|
||||||
|
if length(S) >= 1
|
||||||
|
A = subsref(A, S);
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue