How do I change the license search location for MATLAB?

166 Ansichten (letzte 30 Tage)
I would like to use a license file other than the default for MATLAB. How do I change where MATLAB searches for licenses?

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 11 Apr. 2023
Bearbeitet: MathWorks Support Team am 11 Apr. 2023
You might find yourself in a situation where you need to start MATLAB with a specific license file for troubleshooting purposes. If you are unsure of where you license file is, take a look at the article below:
Once you have located your license file, look below for the operating system that you are using MATLAB on and follow the directions that go along with it.
Windows
There are two ways to override the default license search path for MATLAB:
1. Using the "-c" startup flag for MATLAB
Using the -c flag will override any default license search paths unlike the MLM_LICENSE_FILE variable. The -c flag can be used to point to a specific license file (ex: license.lic or network.lic) or it can point to a specific license server (ex: 27000@host.of.server).
You can also manually specify the location of the license file with the -c option to the MATLAB startup script. This can be achieved by editing the "Target" field in the MATLAB shortcut.
  1. Right click on the MATLAB shortcut and choose "Properties"
  2. In the "Target" field, add -c and the path to the license file after the end quotation mark
  3. If you are trying to use a specific license file, write the name and filepath of the license file that you would like MATLAB to use. Your Target field will probably read similarly to the example below:
"C:\Program Files\MATLAB\R2023a\bin\matlab.exe" -c "C:\Program Files\MATLAB\R2023a\licenses\license_jamescomputer_123456_R2023a.lic"
If you are trying to point to a specific license server, you will instead add the port number followed by an @ symbol, and then the hostname. The result may look similar to the example below:
"C:\Program Files\MATLAB\R2023a\bin\matlab.exe" -c 27000@JAMESSERVER
   4. Once you have finished modifying the Target field, you can select "OK" to save your changes and then launch MATLAB from the shortcut.
2. Using the environment variable MLM_LICENSE_FILE (or LM_LICENSE_FILE)
By setting the environment variable MLM_LICENSE_FILE (or LM_LICENSE_FILE), you can insert a new license search path for MATLAB. The variable value will be searched first, but this will not override the original search path. The value for this variable can either be a path to a license file, or it can be used in the port@host notation. For example, to have MATLAB check against the server "license1" on port 27000, you would set the variable value to be: 27000@license1.
MacOS
For Mac, you can use the -c command when launching MATLAB through the Terminal application to have it point to a single license file to use.
  1. Click the magnifying glass in the top right corner of your screen so that Spotlight search opens.
  2. Enter "Terminal" and then open the first result.
  3. Open Finder, which usually resides on your Dock and is a face that is half blue and half grey.
  4. Click on "Applications"
  5. Find the release of MATLAB you would like to use. Right click on it and select "Show Package Contents"
  6. Open the folder "bin"
  7. Drag and drop the "matlab" file onto the terminal screen that you opened earlier. Terminal will probably read with something such as
/Applications/MATLAB_2023a.app/bin/matlab
    8. Type in "-c" without quotation marks in the terminal
    9. Drag and drop your license file that you downloaded into terminal. Your terminal line should now read with something such as
/Applications/MATLAB_2023a.app/bin/matlab -c /Users/james/Documents/MATLAB_licenses/license.lic
   10. Press "Enter" or "Return" on your keyboard and MATLAB should open with the license file that you specified.
Linux
For Linux, you can use the -c command when launching MATLAB through the Terminal application to have it point to a single license file to use.
  1. Open Terminal
  2. Enter the name and file path of the MATLAB program. An example would be
/usr/local/MATLAB/R2023a/bin
          This will vary depending on where you installed MATLAB and which release you are trying to use.
    3. Type in "-c" without the quotation marks
    4. Enter the name and file path of the license file you would like to use. An example would be
/home/james/Documents/license.lic
          The command you have written so far should read something like this example:
/usr/local/MATLAB/R2023a/bin -c /home/james/Documents/license.lic
    5. Enter the command and MATLAB should now run with the license file that was specified.

Weitere Antworten (0)

Kategorien

Mehr zu Introduction to Installation and Licensing finden Sie in Help Center und File Exchange

Tags

Noch keine Tags eingegeben.

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by