Skip to content
Snippets Groups Projects
Commit c6d93d68 authored by Stéphane Adjemian's avatar Stéphane Adjemian
Browse files

Added new syntax to remove variables from a dseries object.

If ts is a dseries object, then

ts{'Variable_1','Variable_2'} = [];

or

ts{'Variable_@1,2@} = [];

will remove Variable_1 and Variable_2 from ts (if they exist).
parent 7154079a
No related branches found
No related tags found
No related merge requests found
......@@ -77,6 +77,12 @@ switch length(S)
end
end
end
if isempty(B)
for i=1:length(S(1).subs)
A = remove(A,S(1).subs{i});
end
return
end
if ~isequal(length(S(1).subs),B.vobs)
error('dseries::subsasgn: Wrong syntax!')
end
......@@ -845,7 +851,7 @@ end
%$ T = all(t);
%@eof:21
%@test:21
%@test:22
%$ % Define a datasets.
%$ A = rand(1,3);
%$
......@@ -867,4 +873,28 @@ end
%$ t(4) = dyn_assert(ts.data,repmat(A,4,1),1e-15);
%$ end
%$ T = all(t);
%@eof:21
\ No newline at end of file
%@eof:22
%@test:23
%$ % Instantiate a dseries object.
%$ ts0 = dseries(randn(10,6), '1999y');
%$
%$ % Try to remove Variable_2 and Variable_3
%$ try
%$ ts0{'Variable_@2,3@'} = [];
%$ t(1) = 1;
%$ catch
%$ t(1) = 0;
%$ end
%$
%$ if t(1)
%$ % Try to display Variable_2 and Variable_3 again (should fail because already removed)
%$ try
%$ ts0{'Variable_@2,3@'};
%$ t(2) = 0;
%$ catch
%$ t(2) = 1;
%$ end
%$ end
%$ T = all(t);
%@eof:23
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment