TP-traitement-audio-visuel/TP11/recherche_avancee.m
2023-06-22 20:47:16 +02:00

29 lines
681 B
Matlab

function resultats = recherche_simplifiee(identifiants, temps, bdd)
resultats = [];
for i = 1:length(identifiants)
if isKey(bdd, identifiants(i))
entry = bdd(identifiants(i));
if length(entry) == 0
continue;
end
resultats = [ resultats ; entry(:, 2), entry(:, 1) - temps(i) ];
end
end
[C, ia, ic] = unique(resultats(:,2), 'rows', 'stable');
h = accumarray(ic, 1);
[m, ind] = max(h);
start = C(ind, 1);
indexs = start * 0.9 <= resultats(:, 2) & resultats(:, 2) <= start + max(temps) * 1.1;
resultats = resultats(indexs, 1);
end