From 9f117f9d004faa6f7ae43236e1699efcbd02a17a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Fri, 29 Mar 2013 11:54:39 +0100 Subject: [PATCH] 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. --- matlab/@dynSeries/size.m | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/matlab/@dynSeries/size.m b/matlab/@dynSeries/size.m index efc28e7a5..d147ef823 100644 --- a/matlab/@dynSeries/size.m +++ b/matlab/@dynSeries/size.m @@ -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 . a = c.nobs; -b = c.vobs; \ No newline at end of file +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 \ No newline at end of file