set()
Use this method to assign values to objects of the basic data types.
Syntax
Use these methods to assign property values. All assignment methods return the object itself, which means that assignment methods can be appended to each other.
The basic method for assignments is
something.set(name,<value>);
The name argument is a string with the name of the property. The <value> argument can be of different types as indicated in Table 2-4, where the two different syntaxes for assignment in the COMSOL API and the LiveLink for MATLAB® are listed.
set("name","value")
set('name','value')
set("name",
new String[]{"val1","val2"})
set('name',{'val1','val2'})
set("name",new String[][]{{"1","2"},
{"3","4"}})
set('name',{'1','2';'3','4'})
set("name",17)
set('name',17)
set("name",new int[]{1,2})
set('name',[1 2])
set("name",new int[][]{{1,2},
{3,4}})
set('name',[1 2; 3 4])
set("name",1.3)
set('name',1.3)
set("name",new double[]{1.3,2.3})
set('name',[1.3 2.3])
set("name",new double[][]{{1.3,2.3},
{3.3,4.3}})
set('name',[1.3 2.3; 3.3 4.3])
set("name",true)
set('name',true)
set("name",new boolean[]{true,false})
set('name',[true,false])
set("name",new boolean[][]
{{true, false},{false, false}})
set('name',
[true,false;false,false])
For matrix-type properties, set(name,<string>) splits the string at spaces and commas.
The following example shows how two set methods can be appended:
model.result("pg1").set("edgecolor", "black").set("edges", "on");
 
This is equivalent to:
model.result("pg1").set("edgecolor", "black");
model.result("pg1").set("edges", "on");
 
That is, in this case, the set method returns the plot group "pg1".
The following methods using set are deprecated in version 5.1 (use setIndex() instead):
set(name,pos,<value>)
set(name,pos1,pos2,<value>)
The following methods using set are deprecated in version 5.0:
com.comsol.model.ParameterEntity.set(String, int, double)
com.comsol.model.ParameterEntity.set(String, int, double[])
com.comsol.model.ParameterEntity.set(String, int, int)
com.comsol.model.ParameterEntity.set(String, int, int[])
com.comsol.model.ParameterEntity.set(String, int, int, double)
com.comsol.model.ParameterEntity.set(String, int, int, int)
com.comsol.model.ParameterEntity.set(String, int, int, String)
com.comsol.model.ParameterEntity.set(String, int, String)
com.comsol.model.ParameterEntity.set(String, int, String[])
See Also
get* and Selection Access Methods, setIndex()