Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
1006b849
Commit
1006b849
authored
Mar 29, 2013
by
Houtan Bastani
Browse files
reporting: factorize max range code for eventual use with @table
parent
513272a8
Changes
4
Hide whitespace changes
Inline
Side-by-side
matlab/reports/@graph/createGraph.m
View file @
1006b849
...
...
@@ -47,20 +47,15 @@ if o.grid
set
(
gca
,
'GridLineStyle'
,
'--'
);
end
if
isempty
(
o
.
xrange
)
dd
=
o
.
seriesElements
.
getMaxRange
();
else
dd
=
o
.
xrange
;
end
ne
=
o
.
seriesElements
.
numElements
();
dd
=
dynDates
();
for
i
=
1
:
ne
ddt
=
o
.
seriesElements
(
i
)
.
getLine
(
o
.
xrange
);
if
isempty
(
dd
)
dd
=
ddt
;
else
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
o
.
seriesElements
(
i
)
.
getLine
(
dd
);
end
x
=
1
:
1
:
dd
.
ndat
;
...
...
matlab/reports/@series/getLine.m
View file @
1006b849
function
dd
=
getLine
(
o
,
xrange
)
%function
dd
= getLine(o, xrange)
function
o
=
getLine
(
o
,
xrange
)
%function
o
= getLine(o, xrange)
% Create the series
%
% INPUTS
...
...
@@ -7,7 +7,7 @@ function dd = getLine(o, xrange)
% xrange [dynDates] range of x values for line
%
% OUTPUTS
%
dd
[
dynDates] dynDates representing the range of the line
%
o
[
series] series object
%
% SPECIAL REQUIREMENTS
% none
...
...
@@ -61,11 +61,11 @@ assert(~(strcmp(o.line_style, 'none') && isempty(o.marker)), ['@series.series: '
assert
(
isempty
(
xrange
)
||
isa
(
xrange
,
'dynDates'
));
%%
ds
=
o
.
data
;
if
~
isempty
(
xrange
)
if
isempty
(
xrange
)
||
xrange
==
o
.
data
.
time
ds
=
o
.
data
;
else
ds
=
o
.
data
(
xrange
);
end
dd
=
ds
.
time
;
opt
=
{
'XData'
,
1
:
length
(
ds
.
data
)};
opt
=
{
opt
{:},
'YData'
,
ds
.
data
};
...
...
matlab/reports/@series/getRange.m
0 → 100644
View file @
1006b849
function
dd
=
getRange
(
o
)
%function dd = getRange(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
)
&&
size
(
o
.
data
,
2
)
==
1
);
dd
=
o
.
data
.
time
;
end
\ No newline at end of file
matlab/reports/@seriesElements/getMaxRange.m
0 → 100644
View file @
1006b849
function
dd
=
getMaxRange
(
o
)
% function dd = getMaxRange(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/>.
ne
=
numElements
(
o
);
ddmin
=
dynDate
();
ddmax
=
dynDate
();
for
i
=
1
:
ne
a
=
getSeriesElements
(
o
,
1
);
ddt
=
a
.
getRange
();
if
isempty
(
ddmin
)
ddmin
=
ddt
(
1
);
ddmax
=
ddt
(
size
(
ddt
));
else
ddmin
=
min
(
ddt
(
1
),
ddmin
);
ddmax
=
max
(
ddt
(
size
(
ddt
)),
ddmax
);
end
end
dd
=
ddmin
:
ddmax
;
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment