The first step to prepare for an MMC simulation is to prepare a tetrahedral mesh. In this case, the matlab script "createmesh.m" does everything for you. Please look into the script to understand the key elements:
sessionid='onecube'; addpath('../../matlab/'); [node,elem]=genT6mesh(0:1,0:1,0:1); elem=sortrows(elem); elem(:,1:4)=meshreorient(node,elem(:,1:4)); node=node*10; srcpos=[2,8,0]; savemmcmesh(sessionid,node,elem,); eid=tsearchn(node,elem(:,1:4),srcpos)
The first line defines a session id, this will be used in the later simulation to identify the input and output files. The second line adds the matlab toolbox provided in the mmc package. It includes a simple mesh generator for uniform cubic domain (or grid), such as genT5mesh and genT6mesh. The next line calls the mesh generator to produce the tetrahedral mesh: node is the node coordinates and elem is the tetrahedron node indices.