LiveLink™ for MATLAB® Updates


For users of LiveLink™ for MATLAB®, COMSOL Multiphysics® version 6.3 provides a new wrapper file, support for searching regular expressions in the Model Library, and a new function for writing meshes as .mphtxt or .mphbin files. Read more about these updates below.

New mphstartcomsolmphserver Wrapper File

A new wrapper for launching a COMSOL Multiphysics server has been released, designed to simplify the process of starting a server directly from within MATLAB® when MATLAB® has been started independently. This is particularly useful in scenarios where a complex software solution is developed that only requires functionality in COMSOL® occasionally or for a limited time. Another important use case is when using the Parallel Computing Toolbox™, where multiple servers need to be started and connected to within the same computation. The mphstartcomsolmphserver function can return a port number, which can then be used with the mphstart function to establish a connection between MATLAB® and the newly launched server.

Support for Searching Regular Expressions in the Model Library

In LiveLink™ for MATLAB®, functionality for searching the Model Library was introduced in version 6.2. This version now includes the ability to search using regular expressions, allowing for more advanced searches and condensing the results more precisely. The doc regexp command can be used to obtain a description of the regular expressions that are supported by MATLAB®.

The Model Library in MATLAB showing the search results of an AC/DC model.
A search for the term "FEM" is performed by typing \<FEM\> into the search field. Note that in MATLAB® the delimiters \< and \> can be used as word boundary anchors so that searches return more precise results. If these anchors are not used, then the search will return any text where the searched term appears; for example, searching for "FEM" without the anchors will return any text that includes "FEM", such as "NAFEMS".

New mphwritemesh Function

For writing meshes as .mphtxt, .mphbin, or .stl files, a new mphwritemesh function is available. This function makes it possible to select the type of mesh elements to write and to specify which parts of the mesh to export where the export uses the full precision of the mesh data. If the mesh contains selections, these can be exported as .mphtxt or .mphbin files. The saved files can be imported into COMSOL Multiphysics® or another software that support these formats.

A submarine model showing the mesh.
Exported mesh from the Magnetic Signature of a Submarine model.
A screenshot showing an .mphtxt file with another screenshot of a submarine model from MATLAB.
The mesh of the submarine model was exported using the mphwritemesh(model,'mesh1','sub','format','mphtxt') command.