- Undocumented Matlab - https://undocumentedmatlab.com -

Additional license data

Posted By Yair Altman On February 15, 2017 | 6 Comments

Matlab’s license function returns the primary license number/ID used by Matlab, but no information about the various toolboxes that may be installed. The ver function returns a bit more information, listing the version number and installation date of installed toolboxes (even user toolboxes, such as my IB-Matlab [1] toolbox). However, no additional useful information is provided beyond that:

>> license
ans =
123456   % actual number redacted
>> ver
MATLAB Version: (R2016b)
MATLAB License Number: 123456
Operating System: Microsoft Windows 7 Professional  Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB                                                Version 9.1         (R2016b)
Curve Fitting Toolbox                                 Version 3.5.4       (R2016b)
Database Toolbox                                      Version 7.0         (R2016b)
Datafeed Toolbox                                      Version 5.4         (R2016b)
Financial Instruments Toolbox                         Version 2.4         (R2016b)
Financial Toolbox                                     Version 5.8         (R2016b)
GUI Layout Toolbox                                    Version 2.2.1       (R2015b)
Global Optimization Toolbox                           Version 3.4.1       (R2016b)
IB-Matlab - Matlab connector to InteractiveBrokers    Version 1.89        Expires: 1-Apr-2018
Image Processing Toolbox                              Version 9.5         (R2016b)
MATLAB Coder                                          Version 3.2         (R2016b)
MATLAB Report Generator                               Version 5.1         (R2016b)
Optimization Toolbox                                  Version 7.5         (R2016b)
Parallel Computing Toolbox                            Version 6.9         (R2016b)
Statistical Graphics Toolbox                          Version 1.2
Statistics and Machine Learning Toolbox               Version 11.0        (R2016b)
>> v = ver
v =
  1×16 struct array with fields:
>> v(1)
ans =
  struct with fields:
       Name: 'Curve Fitting Toolbox'
    Version: '3.5.4'
    Release: '(R2016b)'
       Date: '25-Aug-2016'
>> v(8)
ans =
  struct with fields:
       Name: 'IB-Matlab - Matlab connector to InteractiveBrokers'
    Version: '1.89'
    Release: 'Expires: 1-Apr-2018'
       Date: '02-Feb-2017'

It is sometimes useful [2] to know which license number “owns” which product/toolbox, and the expiration date is associated with each of them. Unfortunately, there is no documented way to retrieve this information in Matlab – the only documented way is to go to your account section on the MathWorks website and check there.
Luckily, there is a simpler way that can be used to retrieve additional information, from right inside Matlab, using matlab.internal.licensing.getFeatureInfo:

>> all_data = matlab.internal.licensing.getFeatureInfo
all_data =
  23×1 struct array with fields:
>> all_data(20)
ans =
  struct with fields:
           feature: 'optimization_toolbox'
           expdate: '31-mar-2018'
              keys: 0
    license_number: '123456'
    entitlement_id: '1409891'
>> all_data(21)
ans =
  struct with fields:
           feature: 'optimization_toolbox'
           expdate: '07-mar-2017'
              keys: 0
    license_number: 'DEMO'
    entitlement_id: '3749959'

As can be seen in this example, I have the Optimization toolbox licensed under my main Matlab license (123456 [actual number redacted]) until 31-mar-2018, and also licensed under a trial (DEMO) license that expires in 3 weeks. As long as a toolbox has any future expiration date, it will continue to function, so in this case I’m covered until March 2018.
We can also request information about a specific toolbox (“feature”):

>> data = matlab.internal.licensing.getFeatureInfo('matlab')
data =
  3×1 struct array with fields:
>> data(1)
data =
  struct with fields:
           feature: 'matlab'
           expdate: '31-mar-2018'
              keys: 0
    license_number: '123456'
    entitlement_id: '1409891'

The drawback of this functionality is that it only provides information about MathWorks’ toolbox, not any user-provided toolboxes (such as my IB-Matlab connector, or MathWorks’ own GUI Layout toolbox). Also, some of the toolbox names may be difficult to understand (“gads_toolbox” apparently stands for the Global Optimization Toolbox, for example):

>> {all_data.feature}
ans =
  1×23 cell array
  Columns 1 through 4
    'curve_fitting_toolbox'    'database_toolbox'    'datafeed_toolbox'    'distrib_computing_toolbox'
  Columns 5 through 8
    'distrib_computing_toolbox'    'excel_link'    'fin_instruments_toolbox'    'financial_toolbox'
  Columns 9 through 15
    'gads_toolbox'    'gads_toolbox'    'image_toolbox'    'image_toolbox'    'matlab'    'matlab'    'matlab'
  Columns 16 through 20
    'matlab_coder'    'matlab_coder'    'matlab_report_gen'    'matlab_report_gen'    'optimization_toolbox'
  Columns 21 through 23
    'optimization_toolbox'    'optimization_toolbox'    'statistics_toolbox'

A related undocumented builtin function is matlab.internal.licensing.getLicInfo:

% Information on a single toolbox/product:
>> matlab.internal.licensing.getLicInfo('matlab')
ans =
  struct with fields:
     license_number: {'123456'  'Prerelease'  'T3749959'}
    expiration_date: {'31-mar-2018'  '30-sep-2016'  '07-mar-2017'}
% Information on multiple toolboxes/products:
>> matlab.internal.licensing.getLicInfo({'matlab', 'image_toolbox'})  % cell array of toolbox/feature names
ans =
  1×2 struct array with fields:
% The full case-insensitive names of the toolboxes can also be used:
>> matlab.internal.licensing.getLicInfo({'Matlab', 'Image Processing toolbox'})
ans =
  1×2 struct array with fields:
% And here's how to get the full list (MathWorks products only):
>> v=ver; data=matlab.internal.licensing.getLicInfo({v.Name})
data =
  1×16 struct array with fields:

I have [still] not found any way to associate a user toolbox/product (such as my IB-Matlab) in a way that will report it in a unified manner with the MathWorks products. If anyone finds a way to do this, please do let me know.
p.s. – don’t even think of asking questions or posting comments on this website related to illegal uses or hacks of the Matlab license…

Categories: High risk of breaking in future versions, Stock Matlab function, Undocumented feature, Undocumented function

6 Comments (Open | Close)

6 Comments To "Additional license data"

#1 Comment By Mikhail On February 15, 2017 @ 20:45

Try “ver -support” to get a listing with license numbers for each toolbox.

#2 Comment By Yair Altman On February 15, 2017 @ 20:52

@Mikhail – yes, but (alas) without expiration dates…

#3 Comment By Collin On February 16, 2017 @ 04:39

This may get you what you want

function out = getInstalled()
    % Problem with the support_packages implementor
    knowGoodTypes = {'toolbox','app','product','zip'};
    out = {};
    k = 1;

    % Get implementors
    jImplementors = com.mathworks.addons_common.AddonManagerFactory.getImplementors();

    iter = jImplementors.listIterator;
    while iter.hasNext
        jImp = iter.next;
        type = char(jImp.getAddonTypeServiced);
        if ismember(type, knowGoodTypes)
                jInstalledList = jImp.getInstalled;
                lenInstalled = length(jInstalledList);
                for itr = 1 : lenInstalled
                    jInstalled = jInstalledList(itr);
                    itype = char(jInstalled.getInstalledAddOnsMetadataToBeSentToManager.getDisplayType);
                    iname = char(jInstalled.getName);
                    iver =  char(jInstalled.getVersion);
                    idate = char(jInstalled.getInstalledDate.toString);
                    out{k,1} = [itype,' : ',iname,' ', iver,' ', idate];
                    k = k+1;


#4 Comment By Brad Stiritz On February 17, 2017 @ 05:17

Hi Yair,

I noticed “Statistical Graphics Toolbox” in your version listing. What is that, if I may ask, please? I couldn’t find any info on my own. Thanks in advance.

#5 Comment By Yair Altman On February 17, 2017 @ 09:41

@Brad – This is the graphics package which is part of the [9] by [10].

#6 Comment By Andrew On February 6, 2018 @ 19:00

Is there any way to return a floating toolbox license without closing the Matlab session? Its not uncommon for me to find that somewhere in my code base I accessed an obscure toolbox which another user now wants to use. At present the only way to that I know of to release the license is to stop what I am doing and shut down Matlab.

Article printed from Undocumented Matlab: https://undocumentedmatlab.com

URL to article: https://undocumentedmatlab.com/articles/additional-license-data

URLs in this post:

[1] IB-Matlab: http://undocumentedmatlab.com/IB-Matlab

[2] sometimes useful: https://www.mathworks.com/matlabcentral/newsreader/view_thread/347230

[3] Customizing axes part 4 – additional properties : https://undocumentedmatlab.com/articles/customizing-axes-part-4-additional-properties

[4] Controlling plot data-tips : https://undocumentedmatlab.com/articles/controlling-plot-data-tips

[5] Sparse data math info : https://undocumentedmatlab.com/articles/sparse-data-math-info

[6] Simulink Data Dictionary : https://undocumentedmatlab.com/articles/simulink-data-dictionary

[7] Draggable plot data-tips : https://undocumentedmatlab.com/articles/draggable-plot-data-tips

[8] Accessing plot brushed data : https://undocumentedmatlab.com/articles/accessing-plot-brushed-data

[9] : https://github.com/tminka/lightspeed/

[10] : https://tminka.github.io

Copyright © Yair Altman - Undocumented Matlab. All rights reserved.