Changed behaviour of @dynSeries/size.

If called with a second input argument (dim), size returns the number of observations if dim==1 or
the number of variables if dim==2. Without this second argument, size returns the number of
observations and the number of variables.
time-shift
Stéphane Adjemian (Charybdis) 2013-03-29 11:54:39 +01:00
parent 077f98445b
commit 9f117f9d00
1 changed files with 19 additions and 2 deletions

View File

@ -1,4 +1,4 @@
function [a,b] = size(c)
function [a,b] = size(c,dim)
% Copyright (C) 2013 Dynare Team
%
@ -18,4 +18,21 @@ function [a,b] = size(c)
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
a = c.nobs;
b = c.vobs;
b = c.vobs;
if nargin>1
if nargout>1
error('dynSeries::size: Wrong calling sequence!')
end
switch dim
case 1
a = c.nobs;
case 2
a = c.vobs;
otherwise
error(['dynSeries::size: Wrong calling sequence! Argument ''' inputname(2) ''' must be equal to 1 or 2.' ])
end
else
a = c.nobs;
b = c.vobs;
end