Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dóra Kocsis
dynare
Commits
78a89f87
Commit
78a89f87
authored
Mar 20, 2013
by
Stéphane Adjemian
Browse files
Handle the case where the variable to be removed does not exist. Added a unitary test.
parent
9b4b7c46
Changes
1
Show whitespace changes
Inline
Side-by-side
matlab/@dynSeries/pop.m
View file @
78a89f87
...
@@ -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
<
http
:
//www.gnu.org/licenses/>.
%
along
with
Dynare
.
If
not
,
see
<
http
:
//www.gnu.org/licenses/>.
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment