From ac05826ef099a0b0b6f76fe8d22578946a3e15fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Sat, 17 May 2014 17:14:52 +0200 Subject: [PATCH] Test that the names of the variables contained in the dseries objects are different. --- matlab/utilities/dseries/from.m | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/matlab/utilities/dseries/from.m b/matlab/utilities/dseries/from.m index ab54de128..42ef92077 100644 --- a/matlab/utilities/dseries/from.m +++ b/matlab/utilities/dseries/from.m @@ -141,6 +141,9 @@ end % Set the number of variables number_of_variables = size(leadlagtable,1); +% Initialize a cell array containing the names of the variables. +variable_names = cell(1); + % Test that all the involved variables are available dseries objects. Also check that % these time series are defined over the time range given by d1 and d2 (taking care of % the lags and leads) and check that each object is a singleton @@ -162,6 +165,15 @@ for i=1:number_of_variables msg = sprintf('dseries::from: Object %s must contain only one variable!\n',current_variable); error(msg) end + if i>1 + if ismember(var.name,variable_names) + error('dseries::from: All the dseries objects should contain variables with different names!') + else + variable_names(i) = {var.name{1}}; + end + else + variable_names(i) = {var.name{1}}; + end if d1