Mercurial > repos > public > sbplib
changeset 35:61367018c46f
Stoped using matFile object in SolutionFile. Changed to load for performance.
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 06 Oct 2015 09:48:46 +0200 |
parents | 2b4f1d3e5630 |
children | c6eb3af205c0 |
files | SolutionFile.m |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/SolutionFile.m Tue Oct 06 09:47:30 2015 +0200 +++ b/SolutionFile.m Tue Oct 06 09:48:46 2015 +0200 @@ -20,9 +20,13 @@ obj.matfile.keys = {}; obj.matfile.entries = {}; else - matObj = matfile(filename,'Writable',true); - obj.matfile.keys = matObj.keys; - obj.matfile.entries = matObj.entries; + loadStruct = load(filename); + obj.matfile.keys = loadStruct.keys; + obj.matfile.entries = loadStruct.entries; + + % matObj = matfile(filename,'Writable',true); + % obj.matfile.keys = matObj.keys; + % obj.matfile.entries = matObj.entries; end obj.keys = obj.matfile.keys; @@ -35,7 +39,9 @@ keys = obj.matfile.keys; entries = obj.matfile.entries; - delete(obj.filename); + if exist(obj.filename,'file') + delete(obj.filename); + end matObj = matfile(obj.filename,'Writable',true); matObj.keys = keys; @@ -80,6 +86,7 @@ % Gets entries where key match exactly. function e = get(obj, key) if ~obj.isKey(key); + key error('No such key: %s', struct2string(key)); end