if find returns empty this ended in a syntax error

time-shift
Houtan Bastani 2019-02-12 16:59:23 +01:00
parent 9c76b1da51
commit 91d99fe645
No known key found for this signature in database
GPG Key ID: 000094FB955BE169
1 changed files with 3 additions and 2 deletions

View File

@ -78,14 +78,15 @@ if ~isempty(param_names)
pidxs = zeros(nparams, 1); pidxs = zeros(nparams, 1);
names = X.name; names = X.name;
for i = 1:nparams for i = 1:nparams
pidxs(i) = find(strcmp(param_names{i}, names)); idx = find(strcmp(param_names{i}, names));
if isempty(pidxs(i)) if isempty(idx)
if ~isempty(eqtags) if ~isempty(eqtags)
error(['Could not find ' param_names{i} ... error(['Could not find ' param_names{i} ...
' in the equations specified by ' strjoin(eqtags, ',')]); ' in the equations specified by ' strjoin(eqtags, ',')]);
end end
error('Couldn''t find parameter in equations'); error('Couldn''t find parameter in equations');
end end
pidxs(i) = idx;
end end
subcols = setdiff(1:X.vobs, pidxs); subcols = setdiff(1:X.vobs, pidxs);
for i = 1:length(subcols) for i = 1:length(subcols)