-
Notifications
You must be signed in to change notification settings - Fork 0
/
save2folder.m
60 lines (53 loc) · 1.42 KB
/
save2folder.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function save2folder(s)
% Backup figures before export to article (prevent matlab figures loss, if app crash)
% todo: if no param, example use of struct
figPath = "figBase/";
figNrList = [
251
253
% 501
% 502 % done by shrinking
503
509
1013
1023
2005
2059
2069
2078
4001
4002
4003
];
if(isfield(s,"figNrList")) figNrList = s.figNrList; end
if(isfield(s,"figPath")) figPath = s.figPath; end
% if(isfield(s,"skipSavedFig")) skipSavedFig = s.skipSavedFig; end
figFilenames = dir(strcat(figPath,"*.fig"));
figHandles = findobj('Type', 'figure');
num = [];
for(i = 1:length(figHandles))
num = [num; figHandles(i).Number];
end
num = sort(num); % figNr
i = [];
toSave = [];
if(iscolumn(figNrList))
figNrList = figNrList';
end
for(i = figNrList)
j = find(num==i);
toSave = [toSave; num(j)];
end
if(isempty(toSave))
disp("No figures on list")
end
% toSave = num; % save all
c = 0;
for (i = toSave')
c = c+1;
if(numel(figFilenames)>= c && numel(figFilenames) <= numel(toSave)) continue; end
figure(i);
figPW("path", figPath, "exportPDF", 0,"openFolder",1,"saveCopyFig", 1,"skipSaveAs", 1, "TNR", 0);
close(i);
end
end