File Exchange

image thumbnail


version 1.0 (1.49 KB) by

Draws a 3-D cube in a 3-D graph.



View License

Simple function to draw a voxel (cube, cuboid) in a specific position of specific dimensions in a 3-D plot. Transparency of the voxel can also be specified.
Many voxels can be aggregated to form a different shapes (a simple 3-D "+" is shown in the screenshot).

Comments and Ratings (30)

Zhen Han

Thanks for sharing the great function. Can anyone please tell me how to draw many voxels using this function? Does it need a for loop? Thank you very much



QR Fu (view profile)

Andrea Libri


Cathy (view profile)

adan flores

adan flores


Felix (view profile)

excellent and easy to use! Thanks a lot.



Nima Moshtagh

Nima Moshtagh (view profile)

kumar abc

i am beginner , can anyone please tell me how to run this file,
i wrote the program on a new m file and tried to run it but it did not work.


Petter (view profile)

alpha is not assigned a default value when the function is called with two parameters


Chris (view profile)

Great little script. When I try to use it for large grids, it is extremely slow though. Is there something that can be done to speed it up?

oodbae adriano

very useful function and efficient

Cathy S

This is a great function. The commenting makes it easy to implement. Thank you for making my 3D voxel images better!

Sohail iqbal

Good program, fairly simple code, I like it.

Andres Ortiz

s s

A nice tidy function that i found really useful for displaying range data. Thanks.

Christian Peccei

Simple to use and works well. Great!

chi ma


Matlab isfun

Nick Cheilakos

Excellent work.

ahmed far&away

simple and good... saves lot of code writings..

Jack Peach

Very simple and easy to use. Thank you!

Captain Nemo

Found via google search for
matlab script draw cube

Vincent Keller

Exactly what I search !

With some modification it fit with my problem. Thanks

John Jenevall

Simple and effective! Thank you!



License update

MATLAB Release
MATLAB 5.3 (R11)

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

» Watch video