MATLAB: How to change the license server used by MATLAB clients

MATLAB

I have just installed a new Network License Manager, and would like to "retarget" my MATLAB installations to this new server.

Best Answer

This can be accomplished in 3 ways:
1) Replacing the license files MATLAB uses
2) Setting an environment variable to point to a new server
3) Launching MATLAB using the -c flag
-----Method 1-----
MATLAB clients will have a license file located in $MATLAB\licenses (R2008a or later) or $MATLAB\bin\win32 (windows) or $MATLAB/etc (linux/mac). This file consits of a SERVER line, and a USE_SERVER line. To retarget the client, replace the SERVER line with the new SERVER line from the new manager, save the file, and start MATLAB.
-----Method 2-----
During MATLAB's startup, it checks the enviornment variables "LM_LICENSE_FILE" and "MLM_LICENSE_FILE". To launch MATLAB using a license from a new server, set an environment variable with either of these names to a value using the syntax {port}@{hostname} of the license server, where {port} is the number at the end of the SERVER line, and {hostname} is the resolveable name of the license manager.
For example, if the Network License Manager had a server line that read as follows:
SERVER licenseserver1 001122aabbcc 27000
the environment variable value should be set as
LM_LICENSE_FILE=27000@licenseserver1
-----Method 3-----
When launching MATLAB, you can also force it to use a particular license by using the -c flag. The argument that follows -c can be in the form of a path to a license file, or using the <port>@<hostname> syntax mentioned above. For example:
matlab -c 12345@licenseserver
On Windows machines, you can modify the target field of the MATLAB shortcut as follows for a similar effect:
"C:\Program Files\MATLAB\R2008a\bin\matlab.exe" -c 12345@licenseserver