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);
names = X.name;
for i = 1:nparams
pidxs(i) = find(strcmp(param_names{i}, names));
if isempty(pidxs(i))
idx = find(strcmp(param_names{i}, names));
if isempty(idx)
if ~isempty(eqtags)
error(['Could not find ' param_names{i} ...
' in the equations specified by ' strjoin(eqtags, ',')]);
end
error('Couldn''t find parameter in equations');
end
pidxs(i) = idx;
end
subcols = setdiff(1:X.vobs, pidxs);
for i = 1:length(subcols)