You can use MATLAB® variables to set properties of a COMSOL Multiphysics model. Use the
set or
setIndex methods to pass the variable value from MATLAB to the COMSOL model.
Use the set method to assign parameter and property values. All assignments return the parameter object, which means that assignment methods can be appended to each other.
The name argument is a string with the name of the parameter or property. The
<value> argument can, for example, be a MATLAB integer or double array variable.
<value> can also be a string; in this case, the value or expression is defined within the model object.
Use the setIndex method to assign values to specific (0-based) indices in an array or matrix property. All assignment methods return the parameter object, which means that assignment methods can be appended to each other:
The name argument is a string with the name of the property;
<value> is the value to set the property, which can be a MATLAB variable value or a string; and
<index> is the index in the property table.
where [unit] is the
unit you want to set the value property.