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/or 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/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 indices (0-based) 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.