Please login with a confirmed email address before reporting spam
Posted:
1 decade ago
2011年2月4日 GMT-5 05:43
Hi,
this requires, that you connect Matlab to the Comsol server.
In linux it would be the command "comsol matlab server".
Alternatively you can also start Matlab first, then add the path <dir>/COMSOL41/mli (where <dir> is the architecture root directory).
Here is a list of commands, which you should execute in Matlab/Comsol:
In Matlab:
1. addpath <dir>/COMSOL41/mli
2. mphstart
3. import com.comsol.model.*
4. import com.comsol.model.util.*
Then in Comsol "File -> Export Model to Server" and give your model a NAME
Back in Matlab: model = ModelUtil.model('NAME');
Now the model is in your workspace.
With the command mphplot (check the documentation on this for the syntax and options) you can access any plot group of your comsol model and create a matlab plot.
There are some other useful commands that start with "mph" that might be of interest for you.
Hope this helps,
Juergen
Hi,
this requires, that you connect Matlab to the Comsol server.
In linux it would be the command "comsol matlab server".
Alternatively you can also start Matlab first, then add the path /COMSOL41/mli (where is the architecture root directory).
Here is a list of commands, which you should execute in Matlab/Comsol:
In Matlab:
1. addpath /COMSOL41/mli
2. mphstart
3. import com.comsol.model.*
4. import com.comsol.model.util.*
Then in Comsol "File -> Export Model to Server" and give your model a NAME
Back in Matlab: model = ModelUtil.model('NAME');
Now the model is in your workspace.
With the command mphplot (check the documentation on this for the syntax and options) you can access any plot group of your comsol model and create a matlab plot.
There are some other useful commands that start with "mph" that might be of interest for you.
Hope this helps,
Juergen
Please login with a confirmed email address before reporting spam
Posted:
8 years ago
2016年6月26日 GMT-4 04:03
hi
I tried your solution but I got an error as below:
Undefined variable "ModelUtil" or class "ModelUtil.model".
hi
I tried your solution but I got an error as below:
Undefined variable "ModelUtil" or class "ModelUtil.model".
Lars Gregersen
COMSOL Employee
Please login with a confirmed email address before reporting spam
Posted:
8 years ago
2016年6月27日 GMT-4 07:30
Hi
In recent versions of Comsol you can simply do
pd = mphplot(model, 'pg1');
and then pd is a struct variable that contains all the necessary settings for recreating the plot in Matlab.
Note that this requires LiveLink for Matlab.
--
Lars Gregersen
Comsol Denmark
Hi
In recent versions of Comsol you can simply do
pd = mphplot(model, 'pg1');
and then pd is a struct variable that contains all the necessary settings for recreating the plot in Matlab.
Note that this requires LiveLink for Matlab.
--
Lars Gregersen
Comsol Denmark