About This Product
LiveLink™ for MATLAB® connects COMSOL Multiphysics to the MATLAB scripting environment. Using this functionality you can do the following:
Set Up Models from a Script
LiveLink™ for MATLAB® includes the COMSOL API, which has all the necessary functions and methods to implement models from scratch. For each operation done in the COMSOL Desktop there is a corresponding command that is entered at the MATLAB prompt. It is a simplified syntax based on Java® and does not require any Java knowledge. The easiest way to learn this syntax is to save the model as an M-file directly from the COMSOL Desktop. Read more about building a model using the command line in the section Building Models.
Use MATLAB Functions in Model Settings
Use LiveLink™ for MATLAB® to set model properties with a MATLAB function. For example, define material properties or boundary conditions as a MATLAB routine that is evaluated while the model is solved. Read more in Calling External Functions.
Leverage MATLAB Functionality for Program Flow
Use the API syntax together with MATLAB functionality to control the flow of your programs. For example, implement nested loops using for or while commands, implement conditional model settings with if or switch statements, or handle exceptions using try and catch. Some of these operations are described in Running Models in a Loop and Handling Errors and Warnings.
Analyze Results in MATLAB
The API wrapper functions included make it easy to extract data at the command line. Functions are available to access results at node points or arbitrary locations. You can also get low level information about the extended mesh, such as finite element mesh coordinates, and connection information between the elements and nodes. Extracted data are available as MATLAB variables ready to be used with any MATLAB function. See Extracting Results and Retrieving Xmesh Information.
Create Custom Interfaces for Models
Use the MATLAB Guide functionality to create a user-defined graphical interface that is combined with a COMSOL Multiphysics model. Make your models available for others by creating graphical user interfaces tailored to expose settings and parameters of your choice.
Connect to COMSOL Server™
LiveLink™ for MATLAB® has the ability to connect to COMSOL Server™ as well as a COMSOL Multiphysics server. This means that MATLAB scripts and GUIs that utilize COMSOL functionality can be distributed to and used by any user that have access to COMSOL Server™.
Connect to Model Manager
Model Manager can be used to store model files as well as other files. The Model Manager user interface is the default way to access and search for files, but often it can be useful to be able to work with files and models in the Model Manager using programming. Model Manager comes with an API and LiveLink™ for MATLAB® has some additional wrapper functions that makes some of the most common Model Manager features more accessible.