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

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function mk_collage_from_clqs(dir, cliques)
Daniel@0 2
Daniel@0 3 % For use with mk_ps_from_clqs.
Daniel@0 4 % This generates a latex file that glues all the .ps files
Daniel@0 5 % into one big figure.
Daniel@0 6
Daniel@0 7 cd(dir)
Daniel@0 8 C = length(cliques);
Daniel@0 9
Daniel@0 10 ncols = 4;
Daniel@0 11 width = 1.5;
Daniel@0 12 fid = fopen('collage.tex', 'w');
Daniel@0 13 fprintf(fid, '\\documentclass{article}\n');
Daniel@0 14 fprintf(fid, '\\usepackage{psfig}\n');
Daniel@0 15 fprintf(fid, '\\begin{document}\n');
Daniel@0 16 fprintf(fid, '\\centerline{\n');
Daniel@0 17 fprintf(fid, '\\begin{tabular}{');
Daniel@0 18 for col=1:ncols, fprintf(fid, 'c'); end
Daniel@0 19 fprintf(fid, '}\n');
Daniel@0 20 c = 1;
Daniel@0 21 for row = 1:floor(C/ncols)
Daniel@0 22 for col=1:ncols-1
Daniel@0 23 fname = sprintf('%s/clq%d.ps', dir, c);
Daniel@0 24 fprintf(fid, '\\psfig{file=%s,width=%3fin} & \n', fname, width);
Daniel@0 25 c = c + 1;
Daniel@0 26 end
Daniel@0 27 fname = sprintf('%s/clq%d.ps', dir, c);
Daniel@0 28 fprintf(fid, '\\psfig{file=%s,width=%3fin} \\\\ \n', fname, width);
Daniel@0 29 c = c + 1;
Daniel@0 30 end
Daniel@0 31 % last row
Daniel@0 32 while (c <= C)
Daniel@0 33 fname = sprintf('%s/clq%d.ps', dir, c);
Daniel@0 34 fprintf(fid, '\\psfig{file=%s,width=%3fin} & \n', fname, width);
Daniel@0 35 c = c + 1;
Daniel@0 36 end
Daniel@0 37 fprintf(fid, '\\end{tabular}\n');
Daniel@0 38 fprintf(fid, '}\n');
Daniel@0 39 fprintf(fid, '\\end{document}');
Daniel@0 40 fclose(fid);
Daniel@0 41
Daniel@0 42 !latex collage.tex &
Daniel@0 43 !dvips -o collage.ps collage.dvi &
Daniel@0 44 !ghostview collage.ps &