Borrow Licenses

License Borrowing Overview

To provide license mobility, MathWorks® supports FlexNet® license borrowing. This capability lets you use MathWorks products on computers that do not have a continuous connection to the license server. After you borrow a license, you can disconnect your system from the network and continue to use the products you have checked out until the borrow period expires. You can also return a borrowed license early.

Limitations

The following limitations apply to license borrowing:

  • Academic licenses, including Concurrent licenses, cannot use license borrowing.

    Commercial Concurrent and Network Named User licenses can use license borrowing.

  • The maximum borrow period is 30 days (720 hours).

  • MathWorks products must be installed on client systems.

Interoperability with Previous MATLAB Releases

MathWorks tries to preserve licensing backward compatibility between releases. For example, you can run R2014b products with a R2016b License File.

Borrowed licenses are not compatible with Release 12 and earlier releases. You can run Release 13 products with a borrow-enabled license, however, using the borrowing capability is not supported.

The following table sums up the interoperability of different releases with borrow-enabled licenses.

Release FamilyRun MATLAB®Borrow Licenses
R14 (and later)YesYes
R13YesNot supported
R12 (and earlier)NoNo

Enable License Borrowing

You must be an Administrator of the license to enable license borrowing.

  1. Request a License File from MathWorks that includes the license borrowing capability. To request a license, go to the MathWorks website at www.mathworks.com, and click Support. On the support page, click Contact support.

    Notes

    • In these License Files, the INCREMENT lines for products include the keyword BORROW=720, where 720 is the maximum number of hours in the borrow period (you cannot change this value). For example:

      INCREMENT MATLAB MLM 17 01-jan-0000 5 52FCH63184G5 BORROW=720 \
      DUP_GROUP=UH SN=220668

    • The maximum borrow period of 720 hours is equal to 30 days.

  2. On your license server, stop the license manager.

  3. On your license server, copy the SERVER and DAEMON lines from the existing License File, matlabroot/etc/license.dat, where matlabroot represents your MATLAB installation folder. For example, here are the SERVER and DAEMON lines from a License File:

    SERVER mysystem 0012110gbc86 27000
    DAEMON MLM C:\Program Files\MATLAB\R2016b\etc\win64\MLM.exe
  4. Paste the SERVER and DAEMON lines that you copied from your existing License File at the top of the new License File that includes the license borrowing capability.

  5. On your license server, replace the existing License File with the new License File.

  6. Restart the license manager.

Manage License Borrowing

Use an options file to control license borrowing behavior. Use FlexNet tools to monitor which licenses are borrowed.

Control License Borrowing with Options Files

You can control various aspects of license borrowing behavior using a FlexNet options file. An options file is a text file that contains option statements. Each option statement begins with a keyword that identifies the option. The following table lists the options you use to control aspects of license borrowing. For more information about these options, see the FlexNet End User’s Guide. To see an example of an options file, see Example: Exclude a User from Borrowing a License.

TaskFlexNet Option to Use

Reserve a specific number of licenses that cannot be borrowed.

Use the BORROW_LOWWATER option.

For example, to make sure that three MATLAB licenses can never be borrowed, use this syntax:


BORROW_LOWWATER matlab 3

Specify which users can borrow licenses for a particular product.

Use the INCLUDE_BORROW option.

For example, to allow the user Fred to borrow a license for the Image Processing Toolbox™, use this syntax:


INCLUDE_BORROW image_toolbox USER fred

Note: When you specify that a particular user can borrow licenses, you exclude all other users.

Specify which users cannot borrow licenses for a particular product.

Use the EXCLUDE_BORROW option.

For example, to prevent the user Donna from borrowing a license for the Image Processing Toolbox, use this syntax:


EXCLUDE_BORROW image_toolbox USER donna

Specify the maximum amount of time a user can borrow a license.

Use the MAX_BORROW_HOURS option.

For example, to limit users of the Image Processing Toolbox to a three day borrow period, use this syntax:


MAX_BORROW_HOURS image_toolbox 72

The borrow period you specify must be less than 30 days, which is the borrow period specified in borrow-enabled licenses from MathWorks.

Example: Exclude a User from Borrowing a License

To illustrate using an options file to control license borrowing behavior, this example uses an options file to exclude a user from borrowing a license for a specific product:

  1. Create the options file.

    An options file is a text file that contains options statements. Using any text editor, create a file that contains the following line. You can give the options file any name and store it in any convenient folder.

    EXCLUDE_BORROW simulink USER fred
  2. Specify the name of the options file on the DAEMON line in your License File.

    On your license server, use any simple text editor to edit your License File, adding the options= keyword to the DAEMON line, as follows. Be sure to use the line continuation character (\) if the DAEMON line extends beyond a single line.

    DAEMON MLM C:\Program Files\MATLAB\R2016b\etc\win64\MLM.exe \
    options=C:\myborrowoptions.opt
  3. Start (or restart) the license manager so that it processes the options file.

After setting up this options file, test it by logging in as the user Fred. Start MATLAB and try to borrow a license for Simulink®. You can do this using the license command at the MATLAB prompt, as follows.

license checkout simulink

Your attempt to borrow a license for Simulink as the user Fred should fail, displaying the following message.

License Manager Error -38.
User/host on EXCLUDE list for feature
Feature: simulink
License path: C:\Program Files\MATLAB\bin\win64\license.dat;
C:\Program Files\MATLAB\bin\win64\*.lic

Determine Which Licenses Are Currently Borrowed

Flexera Software, Inc, the makers of FlexNet, provides tools that you can use to monitor the status of borrowed licenses in your network configuration. You can use the LMTOOLS application or the lmstat command.

Use the LMTOOLS Application on Windows Systems

  1. Log in to your license server.

  2. Navigate to the matlabroot\etc\$ARCH folder, where matlabroot represents the name of your MATLAB installation and $ARCH represents a platform-specific folder.

  3. Start the LMTOOLS application by double-clicking the lmtools.exe executable file.

  4. Select the Server Status tab in the LMTOOLS dialog box.

  5. Click the Perform Status Enquiry button. LMTOOLS displays the status information in the output window. In the status information, each entry in the list for a product shows the total number of licenses for the product and tells how many licenses are currently checked out. For borrowed licenses, the entry for the product includes the keyword (linger:XXX), where XXX specifies the borrow period in seconds.

    -----------
    Status
    ------------
    Flexible License Manager status on Wed 10/5/2016 10:04
    [Detecting lmgrd processes...]
    License server status: 27000@myserver
    License file(s) on myserver: C:\Program Files\MATLAB\R2016b\etc\license.dat:
    
    myserver: license server UP (MASTER) v11.9
    
    Vendor daemon status (on myserver):
    MLM: UP v11.9
    Feature usage info:
    Users of TMW_Archive: (Uncounted, node-locked)
    Users of MATLAB: (Total of 5 licenses issued; Total of 1 license in use)
    "MATLAB" v14, vendor: MLM
    floating license
    myserver myserver (v14) (myserver/27000 101), start Wed 10/5 14:37
    (linger: 121500)
    Users of SIMULINK: (Total of 5 licenses issued; Total of 0 licenses in use)
    Users of Control_Toolbox: (Total of 5 licenses issued; Total of 1 license in use)
    "Control_Toolbox" v14, vendor: MLM
    floating license
    anyuser myserver myserver (v14) (myserver/27000 201), start Wed 10/5 14:37
    (linger: 121500)

Use the lmstat utility on Windows Systems

  1. Log in to your license server and open a DOS command window. One way to open the DOS command window is to select the Run option from the Start menu, type cmd in the text entry field, and then click OK.

  2. Navigate to the matlabroot\etc\$ARCH folder, where matlabroot represents the name of your MATLAB installation and $ARCH represents a platform-specific folder.

  3. Run the lmutil command specifying lmstat as an argument. (On Windows® systems, FlexNet packages all its license management utilities into one program, lmutil.)

    The following example uses the -a option to display all the information returned by lmstat. Note that you must also use the -c option to specify the name of your License File. For more information about lmstat, see the FlexNet End User’s Guide.

    lmutil lmstat -a -c "C:\Program Files\MATLAB\R2016b\etc\license.dat"

In the status information returned by lmstat, each entry in the list for a product shows the total number of licenses for the product and tells how many licenses are currently checked out. For borrowed licenses, the entry for the product includes the keyword (linger:XXX), where XXX specifies the borrow period in seconds.

lmutil - Copyright (c) 1989-2010 by Flexera Software, Inc. 
All Rights Reserved.

Flexible License Manager status on Wed 10/5/2016 10:04
[Detecting lmgrd processes...]
License server status: 27000@myserver
License file(s) on myserver: C:\Program Files\MATLAB\R2016b\etc\license.dat:
myserver: license server UP (MASTER) v11.99
Vendor daemon status (on myserver):
MLM: UP v11.9
Feature usage info:
Users of TMW_Archive: (Uncounted, node-locked)
Users of MATLAB: (Total of 5 licenses issued; Total of 1 license in use)
"MATLAB" v14, vendor: MLM
floating license
myserver myserver (v14) (myserver/27000 101), start Wed 10/5 14:37
(linger: 121500)
Users of SIMULINK: (Total of 5 licenses issued; Total of 0 licenses in use)
Users of Control_Toolbox: (Total of 5 licenses issued; Total of 1 license in use)
"Control_Toolbox" v14, vendor: MLM
floating license
anyuser myserver myserver (v14) (myserver/27000 201), start Wed 10/5 14:37
(linger: 121500)

Note

If the license status information contains entries for the MATLAB Runtime, this does not necessarily mean that an end user has borrowed a license for this product. MATLAB Runtime uses the license borrowing capability. To determine if a user has borrowed a license for the MATLAB Runtime, check the expiration date specified in the listing and compare it to the expiration for licenses that you know an end user borrowed.

Use lmstat on Linux Systems

  1. Log in to your license server.

  2. Navigate to the matlabroot/etc directory, where matlabroot is your MATLAB installation folder.

  3. Run the lmstat utility.

    lmstat -a -c /usr/local/MATLAB/R2016b/etc/license.dat

Turn on Borrow Products Menu Option

Note

Ensure that the client system has a network connection to the license server.

To turn on the menu option for Borrow Products in the Licensing menu:

  1. On the client system, start MATLAB and enter this command:

    matlab.internal.licensing.enableBorrowUI(true)

    After you turn on the menu option for License Borrowing the first time, it remains available any time you start MATLAB.

  2. Restart MATLAB.

  3. Locate the Borrow Products option in the Licensing menu.

    1. On the Home tab, in the Resources section, click Help.

    2. Under Licensing, look for Borrow Products.

Turn Off Borrow Products Menu Option

To turn off the menu option for Borrow Products in the Licensing menu:

  • On the client system, start MATLAB and enter this command:

    matlab.internal.licensing.enableBorrowUI(false)

Borrow Product Licenses by Selecting Products

To borrow licenses by product name:

  1. Start MATLAB.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

  4. Select Borrow selected products by choosing from a list. The dialog box displays the borrow period option, a list of all the licenses that are available, and the Borrow button.

  5. Specify the borrow period: from 1 day (default) to 30 days.

  6. Click the check box next to each product that you want to borrow.

  7. Click Borrow.

  8. Disconnect your computer from the network, and continue using the borrowed products until the borrow period expires. You can return borrowed licenses early.

Borrow Product Licenses Automatically

To borrow product licenses automatically:

  1. Start MATLAB.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

  4. Select Borrow products automatically as you work with them. The dialog box changes to include the borrow period option and the Turn On Borrowing button.

  5. Specify the borrow period: from 1 day (default) to 30 days.

  6. Click Turn On Borrowing.

  7. Work in MATLAB as you would normally, performing the tasks you want to perform when you are disconnected from the network. As you use products, MATLAB borrows the licenses for them automatically. When you have borrowed licenses for all the products that you want to use, click Turn Off Borrowing.

  8. Disconnect your computer from the network and continue using the borrowed products until the borrow period expires. If you want to return borrowed licenses early, see Return Borrowed Licenses Early.

Return Borrowed Licenses Early

To return a borrowed license early:

  1. Connect your computer to your network.

  2. On the Home tab, in the Resources section, click Help.

  3. Under Licensing, click Borrow Products.

  4. Select Return borrowed products early. The dialog box displays a list of currently borrowed products.

  5. Specify the product licenses you want to return early. By default, all borrowed product licenses are selected. Deselect any products you do not want to return.

  6. Click Return.

Note

You cannot borrow licenses and then return them in the same MATLAB session. You must quit MATLAB and restart it before you can return the licenses.

Was this topic helpful?