Create 3D-interactive HTML File from MATLAB surface

This function uses the abiliy from MuPad to create javaview-files (jvd, jvx) and html - documents.
Updated 22 Apr 2010

View License

javaview(surface_handle, filename, destination, source, open_html)

This function generates output files for Javaview (
It allows to display and interact with 3D-Graph not only in the
javaview engine, but also in html-Documents. See javaview
documentation for more information about how to interact.

There are 4 output files:
a) first file (.stl) is generated by the surf2stl function (Many
thanks to Bill McDonald, this function is availabe at the MCFE
and was pick of the week on June 5th, 2009)
b) the second and third file (jvx) and (jvd) are input files for
javaview and are generated by mupad. The jvx-file describes the
3d-graph, the jvd file descrribes scene options
c) the last file is an html file, were the 3d-Graph is displayed

Because the applet in html file need the javaruntime for javaview the
jars directory from the "source" (input parameter) directory is copied
to the destination folder.
open_html is true or false. When it is true your standard webbrowser is
opened and you will see the surface in the html file.

1. surface_handle - handle to surface graph
2. filename - filename for *.stl, .jvx, *.jvd, *.html
3. destination - folder where all files are saved
4. source - source folder of jars (see jvaview installation path)
5. open_html - shows the result html in your standard webbrowser

Sorry for the work around with the handmade copy and paste when to
generate the javaview files. But evalin(symengine, ...) does not produce
the required files.

Online Example:

[X,Y,Z] = peaks(30);
h = surf(X,Y,Z);
javaview(h, 'peaksurface', 'C:\Users\sk\Desktop\3d-PDF\jvtest', 'C:\Program Files (x86)\JavaView\jars', 1)

Bugs and suggestions:
Please send to Sven Koerner: koerner(underline)sven(add)

You need to download and install first:
Symbolic Math Toolbox with MuPad

Cite As

Sven Koerner (2024). Create 3D-interactive HTML File from MATLAB surface (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: Export figure to 3D interactive PDF

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes