Commit 63430a54 authored by MichelJuillard's avatar MichelJuillard
Browse files

dynSeries: replacing strmatch by strcmp

parent 025f0d5b
......@@ -66,7 +66,7 @@ for i=1:nargin-1
while ~isempty(expression)
[token, expression] = strtok(expression,',');
candidate = [VariableName(1:idArobase(1)-1), token, VariableName(idArobase(2)+1:end)];
id = strmatch(candidate,B.name,'exact');
id = find(strcmp(candidate,B.name));
if isempty(id)
error(['dynSeries::extract: Variable ''' candidate ''' does not exist in dynSeries object ''' inputname(1) '''!'])
else
......@@ -88,7 +88,7 @@ for i=1:nargin-1
while ~isempty(expression_2)
[token_2, expression_2] = strtok(expression_2,',');
candidate = [VariableName(1:idArobase(1)-1), token_1, VariableName(idArobase(2)+1:idArobase(3)-1), token_2, VariableName(idArobase(4)+1:end)];
id = strmatch(candidate,B.name,'exact');
id = find(strcmp(candidate,B.name));
if isempty(id)
error(['dynSeries::extract: Variable ''' candidate ''' does not exist in dynSeries object ''' inputname(1) '''!'])
else
......@@ -114,7 +114,7 @@ end
% Get indices of the selected variables
idVariableName = NaN(length(VariableName_),1);
for i = 1:length(idVariableName)
idx = strmatch(VariableName_{i},B.name,'exact');
idx = find(strcmp(VariableName_{i},B.name));
if isempty(idx)
error(['dynSeries::extract: Variable ' VariableName_{i} ' is not a member of ' inputname(1) '!'])
end
......
......@@ -45,7 +45,7 @@ function [ts,id] = pop(ts,a) % --*-- Unitary tests --*--
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
id = strmatch(a,ts.name,'exact');
id = find(strcmp(a,ts.name));
if isempty(id)
id = 0;
return
......
......@@ -21,7 +21,7 @@ if ~ischar(old) || ~ischar(new)
error(['dynSeries::rename: Input arguments ''' inputname(2) ''' and ''' inputname(3) ''' have to be strings!'])
end
idname = strmatch(old,ts.name,'exact');
idname = find(strcmp(old,ts.name));
if isempty(idname)
error(['dynSeries::rename: Variable ' old ' is unknown in dynSeries object ' inputname(1) '!'])
......
......@@ -84,7 +84,7 @@ switch length(S)
for i = 1:B.vobs
if ~isequal(S(1).subs{i},B.name{i})
% Rename a variable.
id = strmatch(S(1).subs{i},A.name);
id = find(strcmp(S(1).subs{i},A.name));
if isempty(id)
% Add a new variable a change its name.
B.name(i) = {S(1).subs{i}};
......@@ -118,7 +118,7 @@ switch length(S)
% Single variable selection.
if ~isequal(S(1).subs,B.name{1})
% Rename a variable.
id = strmatch(S(1).subs,A.name);
id = find(strcmp(S(1).subs,A.name));
if isempty(id)
% Add a new variable a change its name.
B.name(1) = {S(1).subs};
......
......@@ -139,7 +139,7 @@ switch S(1).type
B = feval(S(1).subs,A,S(2).subs{:});
S = shiftS(S);
otherwise % Extract a sub-object by selecting one variable.
ndx = strmatch(S(1).subs,A.name,'exact');
ndx = find(strcmp(S(1).subs,A.name));
if ~isempty(ndx)
B = dynSeries();
B.data = A.data(:,ndx);
......
......@@ -32,7 +32,7 @@ assert(ischar(newtex), 'dynSeries::tex_rename: the newtex name must be a string'
if nargin == 2
idname = 1;
else
idname = strmatch(name, ts.name, 'exact');
idname = find(strcmp(name, ts.name));
if isempty(idname)
error(['dynSeries::tex_rename: Variable ' name ' is unknown in dynSeries object ' inputname(1) '!'])
end
......
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