File Exchange

image thumbnail

Visualization Toolkit (VTK) mex interface

version 1.0 (6.5 KB) by

Files describing how to interface MATLAB with VTK via mex



View License

The code in this submission describes how to download and install the Visualization Toolkit (VTK, and create a MATLAB mex file to interface with it.

An example C++ mex file and code to build and run the mex file are included.

Comments and Ratings (7)


Mimi (view profile)

here is my new version with vtk 6.1, but i used windows:

code is not very pretty, but i already wasted so much time with installing vtk :-/


Haung (view profile)

Can give a new version with VTK6.1.0 ?

it seems different..


marc (view profile)

Mark T

Mark T (view profile)

Thanks Phil. Good instructions - worked out fine (slight deviation in selecting build options in cmake...and VC2008 took about 30 minutes to compile on a 2.0GHz Pentium).
However, when running 'vtkPolyDataRenderer.mexw32' with 'runDemoVTKmexfile.m' I get *random crashes upon calling*.
Could there be a memory leak floating around?

Got it installed on my Opensuse 11.1 with Matlab 2007b. There was one ' bug' due to GLIBCXX inconsistencies, I'd to remove the files and from the matlab/sys/os/glnxa64 directory (64 bit pc).

For the "closing" bug, a work-around exists: type 'q' in the VTK window, and the VTK-window will close as it should do while keeping Matlab alive.

Fredrik Viksten

The openGL shutting down matlab is a well-known ... limitation(?) of the classic openGL implementation. There is an old lngjmp ugly-hackish-fix to get around it but a much better way is to use freeglut which already can handle this.

Abhishek Banerjee

its good but i tested on my Fedora 9 with gcc-4.3 . But when i closed the openGL window my matlab also shutting down ..i dont know why ..

MATLAB Release
MATLAB 7.6 (R2008a)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video