diff --git a/src/@dseries/chain_.m b/src/@dseries/chain_.m index 5c85896ba458269ce738a52da15a125febf5d0ec..d8758816fd1bcdfb8dd4cbde6a90807bc6dc1608 100644 --- a/src/@dseries/chain_.m +++ b/src/@dseries/chain_.m @@ -17,16 +17,36 @@ function o = chain_(o, p) % --*-- Unitary tests --*-- % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <http://www.gnu.org/licenses/>. +noinputname = false; + +if isempty(inputname(1)) + % If method is called with dot notation (eg o.chain_(p) insteady of chain(o, p)), input names + % are not defined. + noinputname = true; +end + if vobs(o)-vobs(p) - error(['dseries::chain: dseries objects ' inputname(1) ' and ' inputname(2) ' must have the same number of variables!']) + if noinputname + error(['dseries::chain: dseries objects must have the same number of variables!']) + else + error(['dseries::chain: dseries objects ' inputname(1) ' and ' inputname(2) ' must have the same number of variables!']) + end end if frequency(o)-frequency(p) - error(['dseries::chain: dseries objects ' inputname(1) ' and ' inputname(2) ' must have common frequencies!']) + if noinputname + error(['dseries::chain: dseries objects must have common frequencies!']) + else + error(['dseries::chain: dseries objects ' inputname(1) ' and ' inputname(2) ' must have common frequencies!']) + end end if lastdate(o)<firstdate(p) - error(['dseries::chain: The last date in ' inputname(1) ' (' date2string(o.dates(end)) ') must not preceed the first date in ' inputname(2) ' (' date2string(p.dates(1)) ')!']) + if noinputname + error(['dseries::chain: The last date in first dseries object (' date2string(o.dates(end)) ') must not preceed the first date in the second dseries object (' date2string(p.dates(1)) ')!']) + else + error(['dseries::chain: The last date in ' inputname(1) ' (' date2string(o.dates(end)) ') must not preceed the first date in ' inputname(2) ' (' date2string(p.dates(1)) ')!']) + end end tdx = find(sum(bsxfun(@eq, p.dates.time, o.dates.time(end,:)),2)==2); diff --git a/src/@dseries/exist.m b/src/@dseries/exist.m index 9ccc794024cb7e49fe20dc400d9a50a16eb73620..bdc21f5022e867d23441b158f868ffac7c7dee69 100644 --- a/src/@dseries/exist.m +++ b/src/@dseries/exist.m @@ -27,7 +27,11 @@ function l = exist(o, varname) % --*-- Unitary tests --*-- % along with Dynare. If not, see <http://www.gnu.org/licenses/>. if ~ischar(varname) - error(['dseries::exist: Input arguments ''' inputname(2) ''' has to be string!']) + if isempty(inputname(2)) + error(['dseries::exist: Input argument (variable name) has to be string!']) + else + error(['dseries::exist: Second input argument ''' inputname(2) ''' has to be string!']) + end end l = ~isempty(strmatch(varname, o.name, 'exact')); diff --git a/src/@dseries/set_names.m b/src/@dseries/set_names.m index 96bfb219452f9fc44fcd897f479b98e3458d6373..1707b77128b13c2eb0c597c6beb3f8c9e18bcadc 100644 --- a/src/@dseries/set_names.m +++ b/src/@dseries/set_names.m @@ -1,4 +1,4 @@ -function o = set_names(o,varargin) % --*-- Unitary tests --*-- +function o = set_names(o, varargin) % --*-- Unitary tests --*-- % Specifies names of the variables in a dseries object (in place modification). % @@ -29,11 +29,19 @@ function o = set_names(o,varargin) % --*-- Unitary tests --*-- n = nargin-1; if ~isdseries(o) - error(['dseries::set_names: ' inputname(1) ' must be a dseries object!']) + if isempty(inputname(1)) + error(['dseries::set_names: First input must be a dseries object!']) + else + error(['dseries::set_names: ' inputname(1) ' must be a dseries object!']) + end end if ~isequal(vobs(o), n) - error(['dseries::set_names: The number of variables in ' inputname(1) ' does not match the number of declared names!']) + if isempty(inputname(1)) + error(['dseries::set_names: The number of variables in first input does not match the number of declared names!']) + else + error(['dseries::set_names: The number of variables in ' inputname(1) ' does not match the number of declared names!']) + end end for i=1:vobs(o)