Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dynare
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dynare
dynare
Commits
ee7f2fb7
Commit
ee7f2fb7
authored
12 years ago
by
Houtan Bastani
Browse files
Options
Downloads
Patches
Plain Diff
reporting: @series support writing colors/marking table rows
parent
57c10f5f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
matlab/reporting/@series/series.m
+4
-0
4 additions, 0 deletions
matlab/reporting/@series/series.m
matlab/reporting/@series/write.m
+74
-0
74 additions, 0 deletions
matlab/reporting/@series/write.m
matlab/reporting/@table/write.m
+4
-24
4 additions, 24 deletions
matlab/reporting/@table/write.m
with
82 additions
and
24 deletions
matlab/reporting/@series/series.m
+
4
−
0
View file @
ee7f2fb7
...
...
@@ -44,6 +44,10 @@ o.graph_marker_edge_color = 'auto';
o
.
graph_marker_face_color
=
'auto'
;
o
.
graph_marker_size
=
6
;
o
.
table_markers
=
false
;
o
.
table_neg_color
=
'red'
;
o
.
table_pos_color
=
'blue'
;
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'series'
),[
'@series.series: with one arg you '
...
'must pass a series object'
]);
...
...
This diff is collapsed.
Click to expand it.
matlab/reporting/@series/write.m
0 → 100644
+
74
−
0
View file @
ee7f2fb7
function
o
=
write
(
o
,
fid
,
dates
,
precision
)
%function o = write(o, fid, dates, precision)
% Write Table Row
%
% INPUTS
% o [series] series object
% xrange [dynDates] range of x values for line
%
% OUTPUTS
% o [series] series 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/>.
%% Validate options passed to function
assert
(
fid
~=
-
1
);
assert
(
isa
(
dates
,
'dynDates'
));
assert
(
isint
(
precision
));
%% Validate options provided by user
assert
(
~
isempty
(
o
.
data
)
&&
isa
(
o
.
data
,
'dynSeries'
),
...
'@series.write: must provide data as a dynSeries'
);
assert
(
ischar
(
o
.
color
),
'@series.write: color must be a string'
);
assert
(
ischar
(
o
.
table_neg_color
),
'@series.write: table_neg_color must be a string'
);
assert
(
ischar
(
o
.
table_pos_color
),
'@series.write: table_pos_color must be a string'
);
assert
(
islogical
(
o
.
table_markers
),
'@series.write: table_markers must be a string'
);
%% Write Output
dataString
=
[
'%.'
num2str
(
precision
)
'f'
];
precision
=
10
^
precision
;
fprintf
(
fid
,
'%% Table Row (series)\n'
);
fprintf
(
fid
,
'%s'
,
o
.
data
.
name
{:});
data
=
o
.
data
(
dates
);
data
=
data
.
data
;
for
i
=
1
:
size
(
data
,
1
)
thisCellData
=
round
(
data
(
i
)
*
precision
)/
precision
;
fprintf
(
fid
,
' &'
);
if
o
.
table_markers
if
thisCellData
<
0
fprintf
(
fid
,
'\\color{%s}'
,
o
.
table_neg_color
);
elseif
thisCellData
>
0
fprintf
(
fid
,
'\\color{%s}'
,
o
.
table_pos_color
);
end
fprintf
(
fid
,
'['
);
end
fprintf
(
fid
,
dataString
,
thisCellData
);
if
o
.
table_markers
fprintf
(
fid
,
']'
);
end
end
fprintf
(
fid
,
' \\\\\n\n'
);
end
This diff is collapsed.
Click to expand it.
matlab/reporting/@table/write.m
+
4
−
24
View file @
ee7f2fb7
...
...
@@ -49,16 +49,6 @@ else
end
ndates
=
dates
.
ndat
;
ne
=
o
.
seriesElements
.
numElements
();
ds
=
dynSeries
();
for
i
=
1
:
ne
if
isempty
(
ds
)
ds
=
o
.
seriesElements
(
i
)
.
getData
(
dates
);
else
ds
=
[
ds
o
.
seriesElements
(
i
)
.
getData
(
dates
)];
end
end
disp
(
'creating table.........'
);
fprintf
(
fid
,
'%% Table Object\n'
);
fprintf
(
fid
,
'\\setlength{\\tabcolsep}{4pt}\n'
);
...
...
@@ -126,20 +116,10 @@ end
fprintf
(
fid
,
'\\\\%%\n'
);
fprintf
(
fid
,
'%%\n'
);
% Table Data
vars
=
ds
.
name
;
nvars
=
size
(
vars
);
data
=
ds
.
data
;
assert
(
isint
(
o
.
precision
));
precision
=
10
^
o
.
precision
;
dataString
=
[
' & %.'
num2str
(
o
.
precision
)
'f'
];
for
i
=
1
:
nvars
fprintf
(
fid
,
'%% Table Row %d\n'
,
i
);
fprintf
(
fid
,
'%s'
,
vars
{
i
});
for
j
=
1
:
ndates
fprintf
(
fid
,
dataString
,
round
(
data
(
j
,
i
)
*
precision
)/
precision
);
end
fprintf
(
fid
,
' \\\\\n\n'
);
% Write Table Data
ne
=
o
.
seriesElements
.
numElements
();
for
i
=
1
:
ne
o
.
seriesElements
(
i
)
.
write
(
fid
,
dates
,
o
.
precision
);
end
fprintf
(
fid
,
'\\bottomrule\n'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment