mphstart
Connect MATLAB® to a COMSOL server.
Syntax
mphstart
mphstart(port)
mphstart(ipaddress, port)
mphstart(ipaddress, port, username, password)
mphstart(ipaddress, port, comsolpath)
mphstart(ipaddress, port, comsolpath, username, password)
Description
mphstart creates a connection with a COMSOL server using the default port number (which is 2036).
mphstart(port) creates a connection with a COMSOL server using the specified port number port.
mphstart(ipaddress, port) creates a connection with a COMSOL server using the specified IP address ipaddress and the port number port. This command assumes that the client and the server machine share the same login properties.
mphstart(ipaddress, port, username, password) creates a connection with a COMSOL server using the specified IP address ipaddress and the port number port, the username username and password password.
mphstart(ipaddress, port, comsolpath) creates a connection with a COMSOL server using the specified IP address and port number using the comsolpath that is specified. This is useful if mphstart cannot find the location of the COMSOL Multiphysics installation.
mphstart(ipaddress, port, comsolpath, username, password) creates a connection with a COMSOL server using the specified IP address, the port number, the username and password using the comsolpath that is specified. This is useful if mphstart cannot find the location of the COMSOL Multiphysics installation.
mphstart can be used to create a connection from within MATLAB when this is started without using the COMSOL with MATLAB option. mphstart then sets up the necessary environment and connect to COMSOL.
Prior to calling mphstart it is necessary to set the path of mphstart.m in the MATLAB path or to change the current directory in MATLAB (for example, using the cd command) to the location of the mphstart.m file.
A COMSOL server must be started prior to running mphstart.
mphstart connect to either a COMSOL Multiphysics Server (started with the command: comsol mphserver) or the COMSOL Server™. To connect to the COMSOL Server™ from a computer that has just MATLAB installed it is necessary to run the COMSOL Server™ Client installer.
Once MATLAB is connected to the server, import the COMSOL class in order to use the ModelUtil commands. To import the COMSOL class enter:
import com.comsol.model.*
import com.comsol.model.util.*
Example
Connect manually MATLAB to a COMSOL Multiphysics Server and create a model:
mphstart
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
Connect manually MATLAB to a COMSOL Multiphysics Server running on the computer with the IP address 192.168.0.1 using port 2037:
mphstart('192.168.0.1',2037)