1function varargout = size(o, varargin) % --*-- Unitary tests --*--
2
3% Overloads size function.
4
5% Copyright (C) 2013-2017 Dynare Team
6%
7% This file is part of Dynare.
8%
9% Dynare is free software: you can redistribute it and/or modify
10% it under the terms of the GNU General Public License as published by
11% the Free Software Foundation, either version 3 of the License, or
12% (at your option) any later version.
13%
14% Dynare is distributed in the hope that it will be useful,
15% but WITHOUT ANY WARRANTY; without even the implied warranty of
16% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17% GNU General Public License for more details.
18%
19% You should have received a copy of the GNU General Public License
20% along with Dynare.  If not, see <http://www.gnu.org/licenses/>.
21
22switch nargout
23  case 0
24    size(o.data, varargin{:})
25  case 1
26    varargout{1} = size(o.data, varargin{:});
27  case 2
28    if isequal(nargin, 1)
29        varargout{1} = size(o.data, 1);
30        varargout{2} = size(o.data, 2);
31    else
32        error('dseries::size: Wrong calling sequence!')
33    end
34  otherwise
35    error('dseries::size: Wrong calling sequence! Cannot return more than two arguments.')
36end
37
38%@test:2
39%$ ts = dseries(randn(10,1));
40%$ try
41%$     dimension = ts.size();
42%$     t(1) = 1;
43%$ catch
44%$     t(1) = 0;
45%$ end
46%$
47%$ if t(1)
48%$     t(2) = dassert(dimension(1), 10);
49%$     t(3) = dassert(dimension(2), 1);
50%$ end
51%$
52%$ T = all(t);
53%@eof:2