Mercurial > repos > public > sbplib
comparison SolutionFile.m @ 32:ddfb98209aa2
Fixed a bunch of problems regarding convergence and saving solutions
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 29 Sep 2015 09:22:22 +0200 |
parents | 986e3efd8543 |
children | 61367018c46f |
comparison
equal
deleted
inserted
replaced
31:d1f9dd55a2b0 | 32:ddfb98209aa2 |
---|---|
1 classdef SolutionFile < handle | 1 classdef SolutionFile < handle |
2 properties | 2 properties |
3 filename | 3 filename |
4 matfile | 4 matfile |
5 % keyHeaders | |
6 keys % Cell array of keys. Each key is a structure | 5 keys % Cell array of keys. Each key is a structure |
7 % entries | 6 % entries |
8 end | 7 end |
9 | 8 |
10 methods | 9 methods |
12 | 11 |
13 obj.filename = filename; | 12 obj.filename = filename; |
14 | 13 |
15 is_new_file = ~exist(filename,'file'); | 14 is_new_file = ~exist(filename,'file'); |
16 | 15 |
17 obj.matfile = matfile(filename,'Writable',true); | 16 % obj.matfile = matfile(filename,'Writable',true); |
17 fprintf('MATLAB SUCKS!!!!\n') | |
18 | 18 |
19 if is_new_file | 19 if is_new_file |
20 obj.matfile.keys = {}; | 20 obj.matfile.keys = {}; |
21 obj.matfile.entries = {}; | 21 obj.matfile.entries = {}; |
22 else | |
23 matObj = matfile(filename,'Writable',true); | |
24 obj.matfile.keys = matObj.keys; | |
25 obj.matfile.entries = matObj.entries; | |
22 end | 26 end |
23 | 27 |
24 % obj.keyHeaders = obj.matfile.keyHeaders; | |
25 obj.keys = obj.matfile.keys; | 28 obj.keys = obj.matfile.keys; |
26 | 29 |
30 end | |
31 | |
32 function stupidSave(obj) | |
33 matObj = matfile(obj.filename,'Writable',true); | |
34 | |
35 keys = obj.matfile.keys; | |
36 entries = obj.matfile.entries; | |
37 | |
38 delete(obj.filename); | |
39 | |
40 matObj = matfile(obj.filename,'Writable',true); | |
41 matObj.keys = keys; | |
42 matObj.entries = entries; | |
27 end | 43 end |
28 | 44 |
29 function list(obj, show_syntax) | 45 function list(obj, show_syntax) |
30 default_arg('show_syntax',false); | 46 default_arg('show_syntax',false); |
31 for i = 1:length(obj.keys) | 47 for i = 1:length(obj.keys) |