Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dseries
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dynare
dseries
Commits
5ad19f2b
Commit
5ad19f2b
authored
Oct 21, 2015
by
Houtan Bastani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add batch rename
(cherry picked from commit
f4d6dd72
)
parent
95661afb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
5 deletions
+28
-5
src/@dseries/rename.m
src/@dseries/rename.m
+28
-5
No files found.
src/@dseries/rename.m
View file @
5ad19f2b
function
ts
=
rename
(
ts
,
old
,
new
)
% --*-- Unitary tests --*--
% Copyright (C) 2013 Dynare Team
% Copyright (C) 2013
-2015
Dynare Team
%
% This file is part of Dynare.
%
...
...
@@ -22,13 +22,15 @@ if isempty(ts)
end
if
nargin
<
3
if
isequal
(
vobs
(
ts
),
1
)
if
isequal
(
vobs
(
ts
),
1
)
||
isequal
(
vobs
(
ts
),
length
(
old
))
new
=
old
;
else
error
(
'dseries::rename: Missing argument!'
)
end
if
~
ischar
(
new
)
error
([
'dseries::rename: Input argument
''
'
inputname
(
2
)
'
''
has to be a string!'
])
if
~
ischar
(
new
)
&&
~
(
iscellstr
(
new
)
&&
isequal
(
vobs
(
ts
),
length
(
new
)))
error
([
'dseries::rename: Input argument
''
'
...
inputname
(
2
)
...
'
''
has to be either a string or a cellstring that has the same number of entries as observed variables!'
])
end
idname
=
1
;
else
...
...
@@ -41,7 +43,11 @@ else
end
end
ts
.
name
(
idname
)
=
{
new
};
if
iscellstr
(
new
)
ts
.
name
=
new
;
else
ts
.
name
(
idname
)
=
{
new
};
end
%@test:1
%$ t = zeros(8,1);
...
...
@@ -105,3 +111,20 @@ ts.name(idname) = {new};
%$
%$ T = all(t);
%@eof:3
%@test:4
%$ t = zeros(2,1);
%$ ts = dseries(randn(10,3));
%$ try
%$ ts = ts.rename({'Dora', 'The', 'Explorer'});
%$ t(1) = 1;
%$ catch
%$ t = 0;
%$ end
%$
%$ if length(t)>1
%$ t(2) = dassert(ts.name, {'Dora', 'The', 'Explorer'});
%$ end
%$
%$ T = all(t);
%@eof:4
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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