Mercurial > hg > camir-aes2014
comparison toolboxes/FullBNT-1.0.7/KPMtools/hash_del.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
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 |