MATLAB: Do I get the error message that the input does not form a closed volume when I am trying to import geometry from STL data file

closederrorimportgeometryMATLABstlvolume

I have created the STL file by importing a WRL into SolidWorks and then exporting to STL. When I read the STL file into MATLAB using the "importGeometry" function, I get an error message.
>> model = createpde(3);
>> importGeometry(model, 'striatum_Mathworks.stl');
Error using pde.DiscreteGeometry
Failed to create geometry, the input does not form a closed volume.
This may be due to missing faces or gaps in the input.
Error in pde.EquationModel/importGeometry (line 56)
gm = pde.DiscreteGeometry(geofilename);

Best Answer

As explained in the error message, there are gaps present in the triangulation. For example, look at the attached imaged "gaps.jpg". While it looks like most of the surface has been triangulated, there are some gaps, highlighted in red. If the goal is to solve a PDE, this geometry cannot have gaps, as this is a requirement for the underlying mesh generator.
To resolve this issue, repair the STL data such that there are no gaps present in the triangulation. MathWorks does not provide tools to repair STL data; however, there may be some open source software solutions geared towards 3D printing that do provide tools to repair STL data. You may want to explore such software solutions to remove the gaps from your data before bringing that data into MATLAB.