View License

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

» Watch video

Highlights from
Visualization Toolkit (VTK) mex interface

4.0 | 4 ratings Rate this file 13 Downloads (last 30 days) File Size: 6.5 KB File ID: #19638 Version: 1.0

Visualization Toolkit (VTK) mex interface


Phil Goddard (view profile)


18 Apr 2008 (Updated )

Files describing how to interface MATLAB with VTK via mex

| Watch this File

File Information

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.

MATLAB release MATLAB 7.6 (R2008a)
Other requirements The example uses VTK5.0, Visual Studio.Net 2003 and cmake4.0 However the generalize to other releases of MATLAB and these products.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (7)
05 Jan 2015 Mimi

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 :-/

Comment only
16 Jun 2014 Haung

Haung (view profile)

Can give a new version with VTK6.1.0 ?

it seems different..

Comment only
19 Mar 2013 marc

marc (view profile)

06 Jul 2009 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?

11 May 2009 Martijn Steenwijk

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.

16 Oct 2008 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.

Comment only
21 Jul 2008 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 ..

Contact us