1function display(o)
2
3% Overloads display method.
4%
5% INPUTS
6% - o  [dseries]   Object to be displayed.
7%
8% OUTPUTS
9% None
10%
11% REMARKS
12% Contray to the disp method, the whole dseries object is not displayed if the number of
13% observations is greater than 40 and if the number of variables is greater than 10.
14
15% Copyright (C) 2011-2017 Dynare Team
16%
17% This file is part of Dynare.
18%
19% Dynare is free software: you can redistribute it and/or modify
20% it under the terms of the GNU General Public License as published by
21% the Free Software Foundation, either version 3 of the License, or
22% (at your option) any later version.
23%
24% Dynare is distributed in the hope that it will be useful,
25% but WITHOUT ANY WARRANTY; without even the implied warranty of
26% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
27% GNU General Public License for more details.
28%
29% You should have received a copy of the GNU General Public License
30% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
31
32vspace = ' ';
33
34if ~vobs(o)
35    disp(vspace)
36    disp([inputname(1) ' is an empty dseries object.'])
37    return
38end
39
40TABLE = ' ';
41
42if vobs(o)<=10
43    if nobs(o)<=40
44        separator = repmat(' | ', nobs(o)+1,1);
45        for t=1:nobs(o)
46            TABLE = char(TABLE, date2string(o.dates(t)));
47        end
48        for i = 1:vobs(o)
49            TABLE = horzcat(TABLE,separator);
50            tmp = o.name{i};
51            for t=1:nobs(o)
52                tmp = char(tmp,num2str(o.data(t,i)));
53            end
54            TABLE = horzcat(TABLE, tmp);
55        end
56    else
57        n = 10;
58        separator = repmat(' | ',2*n+3,1);
59        for t=1:n
60            TABLE = char(TABLE, date2string(o.dates(t)));
61        end
62        TABLE = char(TABLE,vspace);
63        for t = nobs(o)-n:nobs(o)
64            TABLE = char(TABLE, date2string(o.dates(t)));
65        end
66        for i=1:vobs(o)
67            TABLE = horzcat(TABLE,separator);
68            tmp = o.name{i};
69            for t=1:10
70                tmp = char(tmp,num2str(o.data(t,i)));
71            end
72            tmp = char(tmp,vspace);
73            for t=nobs(o)-10:nobs(o)
74                tmp = char(tmp,num2str(o.data(t,i)));
75            end
76            TABLE = horzcat(TABLE, tmp);
77        end
78    end
79else
80    m = 4;
81    if nobs(o)<=40
82        separator = repmat(' | ', nobs(o)+1,1);
83        for t=1:nobs(o)
84            TABLE = char(TABLE, date2string(o.dates(t)));
85        end
86        for i = 1:m
87            TABLE = horzcat(TABLE,separator);
88            tmp = o.name{i};
89            for t=1:nobs(o)
90                tmp = char(tmp,num2str(o.data(t,i)));
91            end
92            TABLE = horzcat(TABLE, tmp);
93        end
94        TABLE = horzcat(TABLE, separator, repmat(' ... ', nobs(o)+1,1));
95        for i = vobs(o)-m+1:vobs(o)
96            TABLE = horzcat(TABLE,separator);
97            tmp = o.name{i};
98            for t=1:nobs(o)
99                tmp = char(tmp,num2str(o.data(t,i)));
100            end
101            TABLE = horzcat(TABLE, tmp);
102        end
103    else
104        n = 10;
105        separator = repmat(' | ',2*n+3,1);
106        for t=1:n
107            TABLE = char(TABLE, date2string(o.dates(t)));
108        end
109        TABLE = char(TABLE,vspace);
110        for t = nobs(o)-n:nobs(o)
111            TABLE = char(TABLE, date2string(o.dates(t)));
112        end
113        for i=1:m
114            TABLE = horzcat(TABLE,separator);
115            tmp = o.name{i};
116            for t=1:10
117                tmp = char(tmp,num2str(o.data(t,i)));
118            end
119            tmp = char(tmp,vspace);
120            for t=nobs(o)-10:nobs(o)
121                tmp = char(tmp,num2str(o.data(t,i)));
122            end
123            TABLE = horzcat(TABLE, tmp);
124        end
125        TABLE = horzcat(TABLE, separator, repmat(' ... ', 2*n+3,1));
126        for i=vobs(o)-m+1:vobs(o)
127            TABLE = horzcat(TABLE,separator);
128            tmp = o.name{i};
129            for t=1:10
130                tmp = char(tmp,num2str(o.data(t,i)));
131            end
132            tmp = char(tmp,vspace);
133            for t=nobs(o)-10:nobs(o)
134                tmp = char(tmp,num2str(o.data(t,i)));
135            end
136            TABLE = horzcat(TABLE, tmp);
137        end
138    end
139end
140disp(vspace)
141disp([inputname(1) ' is a dseries object:'])
142disp(vspace);
143if ~isempty(strtrim(TABLE))
144    disp(TABLE);
145    disp(vspace);
146end
147