I want to draw a simple cubic lattice using MATLAB.
I have read How to plot 3D grid (cube) in Matlab, however, I want to color every small cube.
I have a three-dimensional array in MATLAB, such as,
cube(:,:,1) = [1 0 1
0 1 1
1 1 0]
cube(:,:,2) = [0 0 1
1 1 1
0 1 0]
cube(:,:,3) = [1 1 1
0 1 1
1 0 1]
How can I draw a simple cubic lattice using this array, in which cube(:,:,1)
denotes the first floor of the cubic lattice, cube(:,:,2)
denotes the second floor, and cube(:,:,3)
the third floor.
A 0
denotes a small white cube, whilst a 1
denotes a small black cube.
The desired result is something like this: http://www.instructables.com/id/Puzzle-Cube/