function webfigs(sz,project,append,description) % size, project, append, description if nargin<1 sz = []; end; if nargin<2 project = []; end; if isempty(sz) sz = [6 3]; end; if nargin<3 append = []; end; if isempty(append) append = 0; end; if nargin<4 description = []; end; %webfigs(append,sz) %append: don't delete old ones if 1 %sz 2-vector specifying size if length(sz)== 1 sz = repmat(sz,2,1); end; httproot = ['http://www.damtp.cam.ac.uk/user/holyoake/matlab']; if isempty(project) path_to_page = '~/public_html/matlab/'; page_name = 'matlab.html'; else path_to_page = ['~/public_html/matlab/' project '/']; page_name = 'matlab.html'; end; [tm t t] = mkdir(path_to_page); if ~append if isempty(project) [t t] = unix(['rm ' path_to_page '*.png ' path_to_page page_name]); else [t t] = unix(['rm ' path_to_page '*']); end; end; figlist = get(0,'children'); %html = 'Matlab Figures'; html = ['' description '
']; for i = 1:length(figlist) rstring = randomstring(13); file_name = ['figure' num2str(figlist(i)) '-' rstring]; figure(figlist(i)) set(gcf,'Units','inches','Paperunits','inches'); szo = get(gcf,'Position'); set(gcf,'Position',[szo(1:2) sz]); set(gcf,'Paperposition',[0 0 sz]); print(figlist(i),'-dpng',[path_to_page file_name '.png']); print(figlist(i),'-depsc2',[path_to_page file_name '.eps']); if ~isempty(project) p = [httproot '/' project '/']; else p = [httproot '/']; end; html = [html '' num2str(figlist(i)) ' Download eps ' ]; end; %html = [html '']; if append ostring = 'a'; else ostring = 'w'; end; fp = fopen([path_to_page page_name],ostring); fprintf(fp,html); fclose(fp); webfigs_links(httproot); return;