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
1b7d2e1d
Commit
1b7d2e1d
authored
Oct 17, 2013
by
Houtan Bastani
Browse files
reporting: change table class name to report_table to avoid conflict with matlab function table
parent
63430a54
Changes
9
Hide whitespace changes
Inline
Side-by-side
matlab/reports/@elements/addTable.m
View file @
1b7d2e1d
...
...
@@ -18,5 +18,5 @@ function e = addTable(e, varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
e
.
objArray
=
e
.
objArray
.
addObj
(
table
(
varargin
{:}));
e
.
objArray
=
e
.
objArray
.
addObj
(
report_
table
(
varargin
{:}));
end
\ No newline at end of file
matlab/reports/@report/addSeries.m
View file @
1b7d2e1d
...
...
@@ -30,8 +30,8 @@ function o = addSeries(o, varargin)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
assert
(
isa
(
o
.
pages
(
end
)
.
sections
(
end
)
.
elements
(
end
),
'graph'
)
||
...
isa
(
o
.
pages
(
end
)
.
sections
(
end
)
.
elements
(
end
),
'table'
),
...
'@report.addSeries: you can only add a series to a table or graph object'
);
isa
(
o
.
pages
(
end
)
.
sections
(
end
)
.
elements
(
end
),
'
report_
table'
),
...
'@report.addSeries: you can only add a series to a
report_
table or graph object'
);
o
.
pages
(
end
)
.
sections
(
end
)
.
elements
(
end
)
=
...
o
.
pages
(
end
)
.
sections
(
end
)
.
elements
(
end
)
.
addSeries
(
varargin
{:});
...
...
matlab/reports/@table/addSeries.m
→
matlab/reports/@
report_
table/addSeries.m
View file @
1b7d2e1d
File moved
matlab/reports/@table/display.m
→
matlab/reports/@
report_
table/display.m
View file @
1b7d2e1d
function
display
(
o
)
%function display(o)
% Display a Table object
% Display a
Report_
Table object
%
% INPUTS
% o [
table]
table object
% o [
report_table] report_
table object
%
% OUTPUTS
% none
...
...
matlab/reports/@
table/
table.m
→
matlab/reports/@
report_table/report_
table.m
View file @
1b7d2e1d
function
o
=
table
(
varargin
)
%function o = table(varargin)
% Table Class Constructor
function
o
=
report_
table
(
varargin
)
%function o =
report_
table(varargin)
%
Report_
Table Class Constructor
%
% INPUTS
% 0 args => empty table
% 1 arg (table class) => copy object
% 0 args => empty
report_
table
% 1 arg (
report_
table class) => copy object
%
% OUTPUTS
% none
...
...
@@ -49,13 +49,13 @@ o.range = {};
o
.
precision
=
1
;
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'table'
),[
'With one arg to Table constructor, '
...
'you must pass a table object'
]);
assert
(
isa
(
varargin
{
1
},
'
report_
table'
),[
'With one arg to
Report_
Table constructor, '
...
'you must pass a
report_
table object'
]);
o
=
varargin
{
1
};
return
;
elseif
nargin
>
1
if
round
(
nargin
/
2
)
~=
nargin
/
2
error
([
'Options to Table constructor must be supplied in name/value '
...
error
([
'Options to
Report_
Table constructor must be supplied in name/value '
...
'pairs.'
]);
end
...
...
@@ -68,35 +68,35 @@ elseif nargin > 1
if
~
isempty
(
ind
)
o
.
(
optNames
{
ind
})
=
pair
{
2
};
else
error
(
'%s is not a recognized option to the Table constructor.'
,
pair
{
1
});
error
(
'%s is not a recognized option to the
Report_
Table constructor.'
,
pair
{
1
});
end
end
end
% Check options provided by user
assert
(
ischar
(
o
.
title
),
'@
table.
table: title must be a string'
);
assert
(
islogical
(
o
.
annualAverages
),
'@
table.
table: annualAverages must be true or false'
);
assert
(
islogical
(
o
.
showHlines
),
'@
table.
table: showHlines must be true or false'
);
assert
(
islogical
(
o
.
showVlines
),
'@
table.
table: showVlines must be true or false'
);
assert
(
isint
(
o
.
precision
),
'@
table.
table: precision must be an int'
);
assert
(
ischar
(
o
.
title
),
'@
report_table.report_
table: title must be a string'
);
assert
(
islogical
(
o
.
annualAverages
),
'@
report_table.report_
table: annualAverages must be true or false'
);
assert
(
islogical
(
o
.
showHlines
),
'@
report_table.report_
table: showHlines must be true or false'
);
assert
(
islogical
(
o
.
showVlines
),
'@
report_table.report_
table: showVlines must be true or false'
);
assert
(
isint
(
o
.
precision
),
'@
report_table.report_
table: precision must be an int'
);
assert
(
isempty
(
o
.
range
)
||
(
isa
(
o
.
range
,
'dynDates'
)
&&
o
.
range
.
ndat
>=
2
),
...
[
'@
table.
table: range is specified as a dynDates range, e.g. '
...
[
'@
report_table.report_
table: range is specified as a dynDates range, e.g. '
...
'
''
dynDates(
''
1999q1
''
):dynDates(
''
1999q3
''
)
''
.'
]);
assert
(
isempty
(
o
.
data
)
||
isa
(
o
.
data
,
'dynSeries'
),
...
'@
table.
table: data must be a dynSeries'
);
'@
report_table.report_
table: data must be a dynSeries'
);
assert
(
isempty
(
o
.
seriesToUse
)
||
iscellstr
(
o
.
seriesToUse
),
...
'@
table.
table: seriesToUse must be a cell array of string(s)'
);
'@
report_table.report_
table: seriesToUse must be a cell array of string(s)'
);
assert
(
isempty
(
o
.
vlineAfter
)
||
isa
(
o
.
vlineAfter
,
'dynDate'
),
...
'@
table.
table: vlineAfter must be a dynDate'
);
'@
report_table.report_
table: vlineAfter must be a dynDate'
);
if
o
.
showVlines
o
.
vlineAfter
=
''
;
end
assert
(
islogical
(
o
.
vlineAfterEndOfPeriod
),
...
'@
table.
table: vlineAfterEndOfPeriod must be true or false'
);
'@
report_table.report_
table: vlineAfterEndOfPeriod must be true or false'
);
valid_title_sizes
=
{
'Huge'
,
'huge'
,
'LARGE'
,
'Large'
,
'large'
,
'normalsize'
,
...
'small'
,
'footnotesize'
,
'scriptsize'
,
'tiny'
};
assert
(
any
(
strcmp
(
o
.
titleSize
,
valid_title_sizes
)),
...
[
'@
table.
table: titleSize must be one of '
strjoin
(
valid_title_sizes
,
' '
)]);
[
'@
report_table.report_
table: titleSize must be one of '
strjoin
(
valid_title_sizes
,
' '
)]);
% using o.seriesToUse, create series objects and put them in o.seriesElements
if
~
isempty
(
o
.
data
)
...
...
@@ -113,6 +113,6 @@ end
o
=
rmfield
(
o
,
'seriesToUse'
);
o
=
rmfield
(
o
,
'data'
);
% Create table object
o
=
class
(
o
,
'table'
);
% Create
report_
table object
o
=
class
(
o
,
'
report_
table'
);
end
\ No newline at end of file
matlab/reports/@table/subsasgn.m
→
matlab/reports/@
report_
table/subsasgn.m
View file @
1b7d2e1d
...
...
@@ -34,9 +34,9 @@ switch S.type
case
fieldnames
(
A
)
B
.
(
S
.
subs
)
=
V
;
otherwise
error
([
'@table.subsasgn: field '
S
.
subs
'does not exist in the table class'
])
error
([
'@
report_
table.subsasgn: field '
S
.
subs
'does not exist in the
report_
table class'
])
end
otherwise
error
(
'@table.subsasgn: syntax error'
)
error
(
'@
report_
table.subsasgn: syntax error'
)
end
end
\ No newline at end of file
matlab/reports/@table/subsref.m
→
matlab/reports/@
report_
table/subsref.m
View file @
1b7d2e1d
...
...
@@ -31,12 +31,12 @@ switch S(1).type
A
=
feval
(
S
(
1
)
.
subs
,
A
);
end
otherwise
error
([
'@table.subsref: unknown field or method: '
S
(
1
)
.
subs
]);
error
([
'@
report_
table.subsref: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
{
'()'
,
'{}'
}
error
([
'@table.subsref: '
S
(
1
)
.
type
' indexing not supported.'
]);
error
([
'@
report_
table.subsref: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
error
(
'@table.subsref: subsref.m impossible case'
)
error
(
'@
report_
table.subsref: subsref.m impossible case'
)
end
S
=
shiftS
(
S
);
...
...
matlab/reports/@table/write.m
→
matlab/reports/@
report_
table/write.m
View file @
1b7d2e1d
function
o
=
write
(
o
,
fid
)
%function o = write(o, fid)
% Write a Table object
% Write a
Report_
Table object
%
% INPUTS
% o [table] table object
% o [
report_
table]
report_
table object
% fid [integer] file id
%
% OUTPUTS
% o [table] table object
% o [
report_
table]
report_
table object
%
% SPECIAL REQUIREMENTS
% none
...
...
@@ -31,7 +31,7 @@ function o = write(o, fid)
assert
(
fid
~=
-
1
);
if
~
o
.
seriesElements
.
numSeriesElements
()
warning
(
'@table.write: no series to plot, returning'
);
warning
(
'@
report_
table.write: no series to plot, returning'
);
return
;
end
...
...
@@ -49,7 +49,7 @@ else
end
ndates
=
dates
.
ndat
;
fprintf
(
fid
,
'%% Table Object\n'
);
fprintf
(
fid
,
'%%
Report_
Table Object\n'
);
fprintf
(
fid
,
'\\setlength{\\tabcolsep}{4pt}\n'
);
fprintf
(
fid
,
'\\begin{tabular}{@{}l'
);
...
...
@@ -105,7 +105,7 @@ switch dates.freq
for
i
=
2
:
size
(
thdr
,
1
)
split
=
find
(
thdr
{
i
-
1
,
2
}
==
4
,
1
,
'first'
);
if
isempty
(
split
)
error
(
'@table.write: Shouldn
''
t arrive here'
);
error
(
'@
report_
table.write: Shouldn
''
t arrive here'
);
else
thdr
{
i
,
2
}
=
thdr
{
i
-
1
,
2
}(
split
+
1
:
end
);
thdr
{
i
-
1
,
2
}
=
thdr
{
i
-
1
,
2
}(
1
:
split
);
...
...
@@ -127,9 +127,9 @@ switch dates.freq
end
end
case
12
error
(
'@table.write: weekly dates not yet implemented'
);
error
(
'@
report_
table.write: weekly dates not yet implemented'
);
otherwise
error
(
'@table.write: invalid dynSeries frequency'
);
error
(
'@
report_
table.write: invalid dynSeries frequency'
);
end
for
i
=
1
:
length
(
yrsForAvgs
)
fprintf
(
fid
,
' & %d'
,
years
(
i
));
...
...
@@ -138,7 +138,7 @@ fprintf(fid, '\\\\[-2pt]%%\n');
fprintf
(
fid
,
'\\hline%%\n'
);
fprintf
(
fid
,
'%%\n'
);
% Write Table Data
% Write
Report_
Table Data
ne
=
o
.
seriesElements
.
numSeriesElements
();
for
i
=
1
:
ne
o
.
seriesElements
(
i
)
.
write
(
fid
,
dates
,
o
.
precision
,
yrsForAvgs
);
...
...
@@ -149,5 +149,5 @@ end
fprintf
(
fid
,
'\\bottomrule\n'
);
fprintf
(
fid
,
'\\end{tabular} \\par \\medskip\n\n'
);
fprintf
(
fid
,
'%% End Table Object\n'
);
fprintf
(
fid
,
'%% End
Report_
Table Object\n'
);
end
matlab/reports/@section/addTable.m
View file @
1b7d2e1d
function
o
=
addTable
(
o
,
varargin
)
%function o = addTable(o, varargin)
% Add a table to the Cell Array of tables in the report
% Add a
report_
table to the Cell Array of
report_
tables in the report
%
% INPUTS
% 1 args => add empty table
% 2 args => add given table
% 3 args => add table at index
% 1 args => add empty
report_
table
% 2 args => add given
report_
table
% 3 args => add
report_
table at index
%
% OUTPUTS
% updated section object
...
...
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