14 |
% 1=section, 2=subsection (not yet implemented) |
% 1=section, 2=subsection (not yet implemented) |
15 |
% myFig is a figure handle (for myStep=2) |
% myFig is a figure handle (for myStep=2) |
16 |
|
|
17 |
if isempty(myFile); |
if isempty(myFile)&myStep==2; |
18 |
|
myText=varargin{1}; |
19 |
|
myText=[myText{:}]; |
20 |
|
gcmfaces_caption(myText); |
21 |
|
return; |
22 |
|
elseif isempty(myFile); |
23 |
%if no file name, then do nothing |
%if no file name, then do nothing |
24 |
return; |
return; |
25 |
end; |
end; |
114 |
if myStep==2; |
if myStep==2; |
115 |
figure(myFig); |
figure(myFig); |
116 |
drawnow; |
drawnow; |
117 |
|
%add (but hide) caption directly in figure |
118 |
|
captionHandle=gcmfaces_caption([myText{:}]); |
119 |
|
set(captionHandle,'Visible','off'); |
120 |
|
set(get(captionHandle,'Children'),'Visible','off'); |
121 |
|
%set file names |
122 |
myFigNumTex=myFigNumTex+1; |
myFigNumTex=myFigNumTex+1; |
123 |
[dirTex,fileTex,EXT] = fileparts(myFile); |
[dirTex,fileTex,EXT] = fileparts(myFile); |
124 |
%print the very figure |
%print figure |
125 |
if strcmp(frmt,'eps'); |
if strcmp(frmt,'eps'); |
126 |
print(myFig,'-depsc',[dirTex fileTex '_fig' num2str(myFigNumTex) '.eps']); |
print(myFig,'-depsc',[dirTex fileTex '_fig' num2str(myFigNumTex) '.eps']); |
127 |
elseif strcmp(frmt,'jpg'); |
elseif strcmp(frmt,'jpg'); |
129 |
elseif strcmp(frmt,'png'); |
elseif strcmp(frmt,'png'); |
130 |
print(myFig,'-dpng',[dirTex fileTex '_fig' num2str(myFigNumTex) '.png']); |
print(myFig,'-dpng',[dirTex fileTex '_fig' num2str(myFigNumTex) '.png']); |
131 |
end |
end |
132 |
|
%save figure (with visible caption) |
133 |
|
set(captionHandle,'Visible','on'); |
134 |
|
set(get(captionHandle,'Children'),'Visible','on'); |
135 |
|
saveas(myFig,[dirTex fileTex '_fig' num2str(myFigNumTex)],'fig'); |
136 |
|
%close figure |
137 |
close; |
close; |
138 |
%add figure to text file |
%add figure to text file |
139 |
fprintf(fid,'\\frame{ \n'); |
fprintf(fid,'\\frame{ \n'); |