No BSD License  

Highlights from
figures2htm

4.33333

4.3 | 3 ratings Rate this file 0 Downloads (last 30 days) File Size: 3.97 KB File ID: #11239
image thumbnail

figures2htm

by Niels de Grooth

 

31 May 2006 (Updated 01 Jun 2006)

Embeds all figures into htm file, with clickable thumbnails and overal index

| Watch this File

File Information
Description

1) Writes all open figures to .png files and integrates them in a html file which opens the figure to full screen if clicked. The figures name or number will be part of the filename.
2) Creates an index.htm for easy acces of several results. Especially handy when a function has to be run often with changing parameters and produces quite some images. Running the function several times without changing the reportdir, creates subdirs for every run + a link in index.htm
3) Writes relative links, so the entire dir can be copied and links still work.
4) Works NOT in Firefox, sorry for that. The generated .htm code is quite crude, but IE renders it.

% example
figure
set(gcf,'NumberTitle','off','Name','Sinewave');
plot(sin(0:0.1:6.3));

figure
plot(rand(40,1));

figure
set(gcf,'Name','Peaks');
surf(peaks);

figures2htm('C:\figdemo\','demo','function')

MATLAB release MATLAB 6.5 (R13)
Other requirements Internet Explorer for viewing the resulting files
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
31 May 2006 J Caspar

Thank you for an excellent tool.

01 Jun 2006 roger jeurissen

Niels, Thank you for your contribution. This seems to be the first step in the direction of automated HTML generation in Matlab. Very original. The publish.m function, converting mfile scripts to HTML, is very different.

Three points of critique:
First, there is a typo in the help, vhere the function name is called "figure2htm", without the "s" before the "2". Second, could you add the example given above to the help in the file? Third, why didn't you use a separate function, such as "savefig.m" by Peder Axensten, for the generation of the image files? This makes the code more transparent.

01 Jun 2006 Niels de Grooth

In reaction to Roger:
1) typo fixed
2) example in help added
3) eehh, didnt know about such a file and I used this kind of code very often.

02 Jun 2006 damien francois

Interesting code. I have tested it with Firefox and everything seems ok. To save figures to files, I generally use the print command along with its -r0 -png arguments. It gives PNG files without the surrounding grey area, and sets the resolution specifically for on-screen viewing. The quality seems to me better than what imwrite gives with its default arguments. Now I guess you can achieve the same results with imwrite by setting the YResolution and XResolution parameters accordingly.

Please login to add a comment or rating.
Updates
01 Jun 2006

Added example in file.
It is reported to work in Firefox 1.5

01 Jun 2006

Type error in the help, where the function name is called "figure2htm", without the "s" before the "2". Is corrected

Tag Activity for this File
Tag Applied By Date/Time
graphics import Niels de Grooth 22 Oct 2008 08:27:19
graphics export Niels de Grooth 22 Oct 2008 08:27:19
figure htm embed png linked index Niels de Grooth 22 Oct 2008 08:27:19

Contact us at files@mathworks.com