comparison toolboxes/FullBNT-1.0.7/KPMtools/hash_del.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:cc4b1211e677
1 function ndx = hash_del(key, fname)
2 % HASH_DEL Remove all entries that match key from hashtable stored in a file
3 % ndx = hash_del(key, fname)
4 %
5 % Returns indices of matching entries (if any)
6 % See hash_lookup for an example
7
8 ndx = [];
9
10 if ~exist(fname, 'file')
11 % new hashtable - no op
12 else
13 %hashtable = importdata(fname);
14 %hashtable = load(fname, '-mat');
15 load(fname, '-mat');
16 Nentries = length(hashtable.key);
17 for i=1:Nentries
18 if isequal(hashtable.key{i}, key)
19 ndx = [ndx i];
20 end
21 end
22 hashtable.key(ndx) = [];
23 hashtable.value(ndx) = [];
24 save(fname, 'hashtable', '-mat');
25 end
26