Please login with a confirmed email address before reporting spam
Posted:
10 years ago
23.01.2015, 00:49 GMT-5
I figure it out myself.
use command line:
foo@bar$ comsol server matlab
to run a server and run a matlab client at the same time.
use command line:
foo@bar$ comsol client
to run a comsol desktop client.
connect the comsol desktop client to the server we just created.
create model from matlab client, using scripts you want to test. For example:
===test.m===
function out = test()
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelPath('/tmp');
model.modelNode.create('comp1');
model.geom.create('geom1', 3);
model.mesh.create('mesh1', 'geom1');
model.geom('geom1').create('blk1', 'Block');
model.geom('geom1').runAll();
out = model;
===test.m===
run this script in matlab console:
>>> m=test();
to obtain the model in the variable 'm'.
The test.m above created a box, we may want to view it in the comsol desktop window.
Turn to the comsol desktop, in 'File' menu, in submenu 'Client Server', click 'Import Model from Server'.
After importing model, we shall see the box in the comsol desktop then. Try this script in matlab:
>>> m.geom('geom1').delete('blk1');
then the block in the comsol desktop should disappear ~ That shows the matlab operation effect in comsol desktop.
I figure it out myself.
use command line:
foo@bar$ comsol server matlab
to run a server and run a matlab client at the same time.
use command line:
foo@bar$ comsol client
to run a comsol desktop client.
connect the comsol desktop client to the server we just created.
create model from matlab client, using scripts you want to test. For example:
===test.m===
function out = test()
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelPath('/tmp');
model.modelNode.create('comp1');
model.geom.create('geom1', 3);
model.mesh.create('mesh1', 'geom1');
model.geom('geom1').create('blk1', 'Block');
model.geom('geom1').runAll();
out = model;
===test.m===
run this script in matlab console:
>>> m=test();
to obtain the model in the variable 'm'.
The test.m above created a box, we may want to view it in the comsol desktop window.
Turn to the comsol desktop, in 'File' menu, in submenu 'Client Server', click 'Import Model from Server'.
After importing model, we shall see the box in the comsol desktop then. Try this script in matlab:
>>> m.geom('geom1').delete('blk1');
then the block in the comsol desktop should disappear ~ That shows the matlab operation effect in comsol desktop.