getEquationsByTags: aesthetic fix

time-shift
Houtan Bastani 2018-01-24 16:12:16 +01:00
parent 4608e6b2cd
commit f3f820135a
1 changed files with 11 additions and 10 deletions

View File

@ -45,19 +45,20 @@ if ischar(tagvalue)
end end
idx2keep = []; idx2keep = [];
for j = 1:length(tagvalue) for i=1:length(tagvalue)
orig_len_idx2keep = length(idx2keep); found = false;
for i=1:length(jsonmodel) for j=1:length(jsonmodel)
assert(isstruct(jsonmodel{i}), 'Every entry in jsonmodel must be a struct'); assert(isstruct(jsonmodel{j}), 'Every entry in jsonmodel must be a struct');
if isfield(jsonmodel{i}, 'tags') && ... if isfield(jsonmodel{j}, 'tags') && ...
isfield(jsonmodel{i}.tags, tagname) && ... isfield(jsonmodel{j}.tags, tagname) && ...
strcmp(jsonmodel{i}.tags.(tagname), tagvalue{j}) strcmp(jsonmodel{j}.tags.(tagname), tagvalue{i})
idx2keep = [idx2keep; i]; idx2keep = [idx2keep; j];
found = true;
break break
end end
end end
if length(idx2keep) == orig_len_idx2keep if found == false
warning(['getEquationsByTags: no equation tag found by the name of ''' tagvalue{j} '''']) warning(['getEquationsByTags: no equation tag found by the name of ''' tagvalue{i} ''''])
end end
end end
assert(~isempty(idx2keep), 'getEquationsByTags: no equations selected'); assert(~isempty(idx2keep), 'getEquationsByTags: no equations selected');