annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/mk_collage_from_clqs.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function mk_collage_from_clqs(dir, cliques)
wolffd@0 2
wolffd@0 3 % For use with mk_ps_from_clqs.
wolffd@0 4 % This generates a latex file that glues all the .ps files
wolffd@0 5 % into one big figure.
wolffd@0 6
wolffd@0 7 cd(dir)
wolffd@0 8 C = length(cliques);
wolffd@0 9
wolffd@0 10 ncols = 4;
wolffd@0 11 width = 1.5;
wolffd@0 12 fid = fopen('collage.tex', 'w');
wolffd@0 13 fprintf(fid, '\\documentclass{article}\n');
wolffd@0 14 fprintf(fid, '\\usepackage{psfig}\n');
wolffd@0 15 fprintf(fid, '\\begin{document}\n');
wolffd@0 16 fprintf(fid, '\\centerline{\n');
wolffd@0 17 fprintf(fid, '\\begin{tabular}{');
wolffd@0 18 for col=1:ncols, fprintf(fid, 'c'); end
wolffd@0 19 fprintf(fid, '}\n');
wolffd@0 20 c = 1;
wolffd@0 21 for row = 1:floor(C/ncols)
wolffd@0 22 for col=1:ncols-1
wolffd@0 23 fname = sprintf('%s/clq%d.ps', dir, c);
wolffd@0 24 fprintf(fid, '\\psfig{file=%s,width=%3fin} & \n', fname, width);
wolffd@0 25 c = c + 1;
wolffd@0 26 end
wolffd@0 27 fname = sprintf('%s/clq%d.ps', dir, c);
wolffd@0 28 fprintf(fid, '\\psfig{file=%s,width=%3fin} \\\\ \n', fname, width);
wolffd@0 29 c = c + 1;
wolffd@0 30 end
wolffd@0 31 % last row
wolffd@0 32 while (c <= C)
wolffd@0 33 fname = sprintf('%s/clq%d.ps', dir, c);
wolffd@0 34 fprintf(fid, '\\psfig{file=%s,width=%3fin} & \n', fname, width);
wolffd@0 35 c = c + 1;
wolffd@0 36 end
wolffd@0 37 fprintf(fid, '\\end{tabular}\n');
wolffd@0 38 fprintf(fid, '}\n');
wolffd@0 39 fprintf(fid, '\\end{document}');
wolffd@0 40 fclose(fid);
wolffd@0 41
wolffd@0 42 !latex collage.tex &
wolffd@0 43 !dvips -o collage.ps collage.dvi &
wolffd@0 44 !ghostview collage.ps &