Using MyMesh in MATLAB#

MyMesh can be used in MATLAB using MATLAB’s python interface. The python environment must be set to an environment where MyMesh has been installed (see pyenv). See the list of compatible versions to be sure an appropriate python version is set for the MATLAB version being used. MyMesh seems to run better when the execution mode is set to “OutOfProcess”. (pyenv("ExecutionMode", "OutOfProcess"))

Once the environment is set, MyMesh commands (or other python functions) can be run by adding a py. prefix, for example:

M = py.mymesh.primitives.Torus([0,0,0], 1, 0.5);

There is no need to first import MyMesh.

Tips for using MyMesh in MATLAB#

  • If a mesh object is created without being suppressed by a semicolon, all properties (e.g. mesh.Centroids, mesh.NodeNeighbors, etc.) will be evaluated. For large meshes, this may cause a significant amount of overhead.