Mercurial > hg > camir-ismir2012
comparison toolboxes/FullBNT-1.0.7/KPMtools/hash_add.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 hash_add(key, val, fname) | |
2 % HASH_ADD Append key,value pair to end of hashtable stored in a file | |
3 % function hash_add(key, val, filename) | |
4 % | |
5 % See hash_lookup for an example | |
6 | |
7 if ~exist(fname, 'file') | |
8 % new hashtable | |
9 hashtable.key{1} = key; | |
10 hashtable.value{1} = val; | |
11 else | |
12 %hashtable = importdata(fname); | |
13 %hashtable = load(fname, '-mat'); | |
14 load(fname, '-mat'); | |
15 Nentries = length(hashtable.key); | |
16 hashtable.key{Nentries+1} = key; | |
17 hashtable.value{Nentries+1} = val; | |
18 end | |
19 save(fname, 'hashtable', '-mat'); |