Mercurial > hg > mauch-mirex-2010
view _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 |
line wrap: on
line source
function hash_add(key, val, fname) % HASH_ADD Append key,value pair to end of hashtable stored in a file % function hash_add(key, val, filename) % % See hash_lookup for an example if ~exist(fname, 'file') % new hashtable hashtable.key{1} = key; hashtable.value{1} = val; else %hashtable = importdata(fname); %hashtable = load(fname, '-mat'); load(fname, '-mat'); Nentries = length(hashtable.key); hashtable.key{Nentries+1} = key; hashtable.value{Nentries+1} = val; end save(fname, 'hashtable', '-mat');