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
0219301e
Commit
0219301e
authored
Feb 19, 2013
by
Houtan Bastani
Browse files
reporting (WIP)
parent
a64ec3b1
Changes
28
Hide whitespace changes
Inline
Side-by-side
matlab/reports/@section/display.m
View file @
0219301e
...
...
@@ -34,9 +34,13 @@ disp([name '.align = ']);
disp
(
' '
);
disp
([
'
''
'
o
.
align
'
''
'
]);
disp
(
' '
);
disp
([
name
'.cols = '
]);
disp
(
' '
);
disp
(
o
.
cols
);
disp
(
' '
);
disp
([
name
'.elements = '
]);
disp
(
' '
);
disp
(
o
.
elements
.
getElements
());
end
\ No newline at end of file
matlab/reports/@section/section.m
View file @
0219301e
...
...
@@ -23,10 +23,8 @@ function o = section(varargin)
o
=
struct
;
o
.
align
=
't'
;
o
.
elements
=
elements
();
o
.
rows
=
1
;
o
.
cols
=
1
;
if
nargin
==
1
assert
(
isa
(
varargin
{
1
},
'section'
),[
'With one arg to Section constructor, '
...
'you must pass a section object'
]);
...
...
@@ -55,4 +53,3 @@ end
% Create section object
o
=
class
(
o
,
'section'
);
end
matlab/reports/@section/subsref.m
View file @
0219301e
...
...
@@ -23,13 +23,6 @@ switch S(1).type
switch
S
(
1
)
.
subs
case
fieldnames
(
A
)
A
=
A
.
(
S
(
1
)
.
subs
);
case
{
'write'
}
if
areParensNext
(
S
)
write
(
A
,
S
(
2
)
.
subs
{:})
S
=
shiftS
(
S
);
else
assert
(
false
);
end
case
methods
(
A
)
if
areParensNext
(
S
)
A
=
feval
(
S
(
1
)
.
subs
,
A
,
S
(
2
)
.
subs
{:});
...
...
@@ -41,7 +34,7 @@ switch S(1).type
error
([
'Section Class: unknown field or method: '
S
(
1
)
.
subs
]);
end
case
'()'
A
=
getElements
(
A
,
S
(
1
)
.
subs
{:});
A
=
A
.
elements
.
getElements
(
S
(
1
)
.
subs
{:});
case
'{}'
error
([
'Section Class: '
S
(
1
)
.
type
' indexing not supported.'
]);
otherwise
...
...
matlab/reports/@section/write.m
View file @
0219301e
function
write
(
o
,
fid
,
indent
)
%function write(o, fid
, indent
)
function
o
=
write
(
o
,
fid
)
%function
o =
write(o, fid)
% Write Section object
%
% INPUTS
% fid - int, file id
% indent - char, number of spaces to indent tex code
%
% OUTPUTS
%
none
%
o - this
%
% SPECIAL REQUIREMENTS
% none
...
...
@@ -31,14 +30,30 @@ function write(o, fid, indent)
assert
(
fid
~=
-
1
);
fprintf
(
fid
,
'\n%s%% Section Object\n'
,
indent
);
fprintf
(
fid
,
'%s\\noindent\\begin{minipage}[%s]{0.32\\hsize}\n'
,
indent
,
o
.
align
);
fprintf
(
fid
,
'%% Section Object\n'
);
fprintf
(
fid
,
'\\begin{table}[%shtpb]\n'
,
o
.
align
);
fprintf
(
fid
,
'\\resizebox{\\textwidth}{!}{\n'
);
fprintf
(
fid
,
'\\begin{tabular}{'
);
for
i
=
1
:
o
.
cols
fprintf
(
fid
,
'c'
);
end
fprintf
(
fid
,
'}\n'
);
% Calculate scaling factor
%sf = round(100/o.cols)/100-.01;
ne
=
numElements
(
o
);
for
i
=
1
:
ne
o
.
elements
(
i
)
.
write
(
fid
,
addIndentation
(
indent
));
o
.
elements
(
i
)
.
write
(
fid
);
if
rem
(
i
,
o
.
cols
)
fprintf
(
fid
,
' & '
);
else
fprintf
(
fid
,
'\\\\\n'
);
end
end
fprintf
(
fid
,
'%s\\end{minipage}\n'
,
indent
);
fprintf
(
fid
,
'%s%% End Section Object\n\n'
,
indent
);
fprintf
(
fid
,
'\\end{tabular}\n'
);
fprintf
(
fid
,
'}\n'
);
fprintf
(
fid
,
'\\end{table}\n'
);
fprintf
(
fid
,
'%% End Section Object\n\n'
);
end
\ No newline at end of file
matlab/reports/@sections/addSection.m
View file @
0219301e
...
...
@@ -18,15 +18,5 @@ function ss = addSection(ss, varargin)
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
assert
(
nargin
>=
1
&&
nargin
<=
3
)
if
nargin
>
1
assert
(
isa
(
varargin
{
1
},
'section'
),
[
'Optional 2nd arg to addSection '
...
'must be a Section'
]);
end
if
nargin
==
1
ss
.
objArray
=
ss
.
objArray
.
addObj
(
section
());
else
ss
.
objArray
=
ss
.
objArray
.
addObj
(
varargin
{:});
end
ss
.
objArray
=
ss
.
objArray
.
addObj
(
section
(
varargin
{:}));
end
\ No newline at end of file
matlab/reports/@sections/subsref.m
View file @
0219301e
...
...
@@ -23,13 +23,6 @@ switch S(1).type
switch
S
(
1
)
.
subs
case
fieldnames
(
A
)
A
=
A
.
(
S
(
1
)
.
subs
);
case
{
'write'
}
if
areParensNext
(
S
)
write
(
A
,
S
(
2
)
.
subs
{:})
S
=
shiftS
(
S
);
else
assert
(
false
);
end
case
methods
(
A
)
if
areParensNext
(
S
)
A
=
feval
(
S
(
1
)
.
subs
,
A
,
S
(
2
)
.
subs
{:});
...
...
matlab/reports/@sections/write.m
View file @
0219301e
function
write
(
o
,
fid
,
indent
)
%function write(o, fid
, indent
)
function
o
=
write
(
o
,
fid
)
%function
o =
write(o, fid)
% Write Sections object
%
% INPUTS
% fid - int, file id
% indent - char, number of spaces to indent tex code
%
% OUTPUTS
%
none
%
o - this
%
% SPECIAL REQUIREMENTS
% none
...
...
@@ -30,10 +29,10 @@ function write(o, fid, indent)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
assert
(
fid
~=
-
1
);
fprintf
(
fid
,
'\n%
s%
% Sections Object\n'
,
indent
);
fprintf
(
fid
,
'\n%% Sections Object\n'
);
nps
=
numSections
(
o
);
for
i
=
1
:
nps
o
.
objArray
(
i
)
.
write
(
fid
,
indent
);
o
.
objArray
(
i
)
.
write
(
fid
);
end
fprintf
(
fid
,
'%
s%
% End Sections Object\n\n'
,
indent
);
fprintf
(
fid
,
'%% End Sections Object\n\n'
);
end
\ No newline at end of file
matlab/reports/@table/write.m
View file @
0219301e
function
write
(
o
,
fid
,
texIndent
)
%function write(o, fid)
% Write a
Pag
e object
function
o
=
write
(
o
,
fid
)
%function
o =
write(o, fid)
% Write a
Tabl
e object
%
% INPUTS
%
none
%
fid - int, file id
%
% OUTPUTS
%
none
%
o - this
%
% SPECIAL REQUIREMENTS
% none
...
...
@@ -31,10 +31,7 @@ function write(o, fid, texIndent)
assert
(
fid
>
0
);
assert
(
isnumeric
(
texIndent
));
fprintf
(
fid
,
'%d\% Page Object\n'
,
texIndent
);
fprintf
(
fid
,
'%d\newpage\n'
,
texIndent
);
o
.
sections
.
write
(
fid
,
texIndent
+
2
);
fprintf
(
fid
,
'%% Page Object\n'
);
fprintf
(
fid
,
'%
d\
% End Page Object\n'
,
texIndent
);
fprintf
(
fid
,
'%% End Page Object\n'
);
end
\ No newline at end of file
Prev
1
2
Next
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