Commit 78a89f87 by Stéphane Adjemian

### Handle the case where the variable to be removed does not exist. Added a unitary test.

parent 9b4b7c46
 ... @@ -45,6 +45,10 @@ function [ts,id] = pop(ts,a) ... @@ -45,6 +45,10 @@ function [ts,id] = pop(ts,a) % along with Dynare. If not, see . % along with Dynare. If not, see . id = strmatch(a,ts.name,'exact'); id = strmatch(a,ts.name,'exact'); if isempty(id) id = 0; return end ts.vobs = ts.vobs-1; ts.vobs = ts.vobs-1; ts.data(:,id) = []; ts.data(:,id) = []; ts.name(id) = []; ts.name(id) = []; ... @@ -75,3 +79,28 @@ ts.tex(id) = []; ... @@ -75,3 +79,28 @@ ts.tex(id) = []; %\$ end %\$ end %\$ T = all(t); %\$ T = all(t); %@eof:1 %@eof:1 %@test:1 %\$ % Define a datasets. %\$ A = rand(10,3); %\$ %\$ % Define names %\$ A_name = {'A1';'A2';'A3'}; %\$ %\$ t = zeros(2,1); %\$ %\$ % Instantiate a time series object. %\$ try %\$ ts1 = dynSeries(A,[],A_name,[]); %\$ [ts2,id] = pop(ts1,'A4'); %\$ t(1) = 1; %\$ catch %\$ t = 0; %\$ end %\$ %\$ if length(t)>1 %\$ t(2) = dyn_assert(id,0); %\$ t(2) = dyn_assert(ts1==ts2,1); %\$ end %\$ T = all(t); %@eof:1
Supports Markdown
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