Mercurial > hg > mauch-mirex-2010
annotate _FullBNT/KPMtools/hash_add.m @ 9:4ea6619cb3f5 tip
removed log files
author | matthiasm |
---|---|
date | Fri, 11 Apr 2014 15:55:11 +0100 |
parents | b5b38998ef3b |
children |
rev | line source |
---|---|
matthiasm@8 | 1 function hash_add(key, val, fname) |
matthiasm@8 | 2 % HASH_ADD Append key,value pair to end of hashtable stored in a file |
matthiasm@8 | 3 % function hash_add(key, val, filename) |
matthiasm@8 | 4 % |
matthiasm@8 | 5 % See hash_lookup for an example |
matthiasm@8 | 6 |
matthiasm@8 | 7 if ~exist(fname, 'file') |
matthiasm@8 | 8 % new hashtable |
matthiasm@8 | 9 hashtable.key{1} = key; |
matthiasm@8 | 10 hashtable.value{1} = val; |
matthiasm@8 | 11 else |
matthiasm@8 | 12 %hashtable = importdata(fname); |
matthiasm@8 | 13 %hashtable = load(fname, '-mat'); |
matthiasm@8 | 14 load(fname, '-mat'); |
matthiasm@8 | 15 Nentries = length(hashtable.key); |
matthiasm@8 | 16 hashtable.key{Nentries+1} = key; |
matthiasm@8 | 17 hashtable.value{Nentries+1} = val; |
matthiasm@8 | 18 end |
matthiasm@8 | 19 save(fname, 'hashtable', '-mat'); |