Commit 54ad6724 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Issue an error if two dynSeries objects with common variable names are...

Issue an error if two dynSeries objects with common variable names are concatenated. Added a unitary test.
parent 4d09ee6a
......@@ -237,3 +237,27 @@ end
%$ t(4) = dyn_assert(ts4.name,e.name);
%$ T = all(t);
%@eof:5
%@test:6
%$ % Define a data set.
%$ A = [transpose(1:10),2*transpose(1:10)];
%$ B = [transpose(1:10),2*transpose(1:10)];
%$
%$ % Define names
%$ A_name = {'A1';'A2'};
%$ B_name = {'B1';'A2'};
%$
%$ % Instantiate two time series objects.
%$ ts1 = dynSeries(A,[],A_name,[]);
%$ ts2 = dynSeries(B,[],B_name,[]);
%$
%$ % Call the tested method.
%$ try
%$ ts3 = [ts1,ts2];
%$ t = 0;
%$ catch
%$ t = 1;
%$ end
%$
%$ T = t;
%@eof:6
......@@ -55,7 +55,12 @@ function a = horzcat2(b,c)
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
[n,message] = common_strings_in_cell_arrays(b.name,c.name);
if n
error(['dynSeries::horzcat: I cannot concatenate dynSeries objects with common variable names (' message ')!'])
end
if b.freq ~= c.freq
error('dynSeries::horzcat: All time series objects must have common frequency!')
else
......
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