34 |
tmp1=which('write2tex'); |
tmp1=which('write2tex'); |
35 |
eval(['!\cp -f ' tmp1(1:end-2) '.header ' myFile ]); |
eval(['!\cp -f ' tmp1(1:end-2) '.header ' myFile ]); |
36 |
end; |
end; |
37 |
|
myFigNumTex=0; |
38 |
|
eval(['save ' myFile(1:end-4) '.mat myFigNumTex;']); |
39 |
end; |
end; |
40 |
|
|
41 |
%open file and go to last line |
%open file and go to last line |
42 |
fid=fopen(myFile,'a+'); |
fid=fopen(myFile,'a+'); |
43 |
|
eval(['load ' myFile(1:end-4) '.mat myFigNumTex;']); |
44 |
|
|
45 |
%add title or section page (see myLev) |
%add title or section page (see myLev) |
46 |
|
|
47 |
%add a figure plus caption (see myFig) |
%add a figure plus caption (see myFig) |
48 |
if myStep==2; |
if myStep==2; |
49 |
figure(myFig); |
figure(myFig); |
50 |
|
drawnow; |
51 |
|
myFigNumTex=myFigNumTex+1; |
52 |
nn=strfind(myFile,'/'); |
nn=strfind(myFile,'/'); |
53 |
if ~isempty(nn); |
if ~isempty(nn); |
54 |
dirTex=myFile(1:nn); fileTex=myFile(nn+1:end-4); |
dirTex=myFile(1:nn(end)); fileTex=myFile(nn(end)+1:end-4); |
55 |
else; |
else; |
56 |
dirTex='./'; fileTex=myFile(1:end-4) |
dirTex='./'; fileTex=myFile(1:end-4) |
57 |
end; |
end; |
58 |
%print the very figure |
%print the very figure |
59 |
print(myFig,'-depsc',[dirTex fileTex '.fig' num2str(myFig)]); |
print(myFig,'-depsc',[dirTex fileTex '.fig' num2str(myFigNumTex)]); |
60 |
|
close; |
61 |
%add figure to text file |
%add figure to text file |
62 |
fprintf(fid,'\\clearpage \n'); |
fprintf(fid,'\\frame{ \n'); |
63 |
fprintf(fid,'\\begin{figure}[tbh] \\centering \n'); |
fprintf(fid,'\\begin{figure}[tbh] \\centering \n'); |
64 |
% fprintf(fid,'\\includegraphics[width=\\textwidth,height=0.9\\textheight]'); |
% fprintf(fid,'\\includegraphics[width=\\textwidth,height=0.9\\textheight]'); |
65 |
fprintf(fid,'\\includegraphics[width=\\textwidth]'); |
fprintf(fid,'\\includegraphics[width=0.85\\textwidth]'); |
66 |
fprintf(fid,['{' fileTex '.fig' num2str(myFig) '}\n']); |
fprintf(fid,['{' fileTex '.fig' num2str(myFigNumTex) '}\n']); |
67 |
fprintf(fid,'\\caption{'); |
fprintf(fid,'\\caption{'); |
68 |
for ii=1:length(myText); fprintf(fid,[myText{ii} '\n']); end; |
for ii=1:length(myText); fprintf(fid,[myText{ii} '\n']); end; |
69 |
fprintf(fid,'} \\end{figure} \n'); |
fprintf(fid,'} \\end{figure} \n'); |
70 |
fprintf(fid,'\\clearpage \n\n'); |
fprintf(fid,'} \n\n'); |
71 |
end; |
end; |
72 |
|
|
73 |
%add a paragraph |
%add a paragraph |
83 |
%close file |
%close file |
84 |
fprintf(fid,'\n\n'); |
fprintf(fid,'\n\n'); |
85 |
fclose(fid); |
fclose(fid); |
86 |
|
eval(['save ' myFile(1:end-4) '.mat myFigNumTex;']); |
87 |
|
|
88 |
%compile |
%compile |
89 |
if myStep==5|myStep==-5; |
if myStep==5|myStep==-5; |