comparison saveeps.m @ 34:2b4f1d3e5630

Imporved error handling in saveeps. Fixed bug with vector fields in struct2string.
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 06 Oct 2015 09:47:30 +0200
parents 48b6fb693025
children a2b95af82f68
comparison
equal deleted inserted replaced
33:6db2094976a6 34:2b4f1d3e5630
28 28
29 % Find the line 29 % Find the line
30 pagel = findPrefix(lines,'%%Pages:'); 30 pagel = findPrefix(lines,'%%Pages:');
31 boundl = findPrefix(lines,'%%BoundingBox:'); 31 boundl = findPrefix(lines,'%%BoundingBox:');
32 32
33
33 if ~(length(pagel) == 2 && length(boundl) == 2) 34 if ~(length(pagel) == 2 && length(boundl) == 2)
34 error('Undexpected number of found lines'); 35 warning('Undexpected number of found lines: %d , %d\nNot correcting the file',pagel, boundl);
36 return
35 end 37 end
36 38
37 if ~(strcmp(lines{pagel(1)},'%%Pages: (atend)') && strcmp(lines{boundl(1)},'%%BoundingBox: (atend)')) 39 if ~(strcmp(lines{pagel(1)},'%%Pages: (atend)') && strcmp(lines{boundl(1)},'%%BoundingBox: (atend)'))
38 error('Does the file really contain the error?'); 40 warning('Does the file really contain the error?\nNot correcting the file');
41 return
39 end 42 end
40 43
41 % Overwrite the nasty lines with the nice ones. 44 % Overwrite the nasty lines with the nice ones.
42 lines{pagel(1)} = lines{pagel(2)}; 45 lines{pagel(1)} = lines{pagel(2)};
43 lines{boundl(1)} = lines{boundl(2)}; 46 lines{boundl(1)} = lines{boundl(2)};