Commit 14fc3fbf authored by Stéphane Adjemian's avatar Stéphane Adjemian

Fixed calls to input name.

parent 4ee3117f
......@@ -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);
......
......@@ -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'));
......
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment