How do features from 'license' correspond to names from 'ver'

181 views (last 30 days)
Thomas Pfau
Thomas Pfau on 18 Jan 2018
Edited: breathi on 8 Jun 2020
I'm currently struggling a bit trying to set up a proper mechanism to check for the presence and availability of a matlab toolbox.
I know that using `ver`, I can get a list of all installed toolboxes in the name field of the resulting struct, and that using `license('test',featurename)` I can check, whether this toolbox is actually license (and can thus be used).
The problem is, that the names from `ver` do not clearly correspond to the feature strings used in `license` (e.g. 'Global Optimization Toolbox' becomes 'Optimization_Toolbox'). There is a list at which details a bunch of "Corresponding" feature / Product pairs, but since whats showing up in the name field changes between matlab versions, I don't want to rely on this.
Is there any programmatic way to find the corresponding values that is valid from at least 2014b?

Accepted Answer

Walter Roberson
Walter Roberson on 18 Jan 2018
Edited: Walter Roberson on 14 Feb 2019
Here is the data I have available to me:
licver_info = {
'Aerospace Blockset' 'Aerospace_Blockset' 'aeroblks'
'Aerospace Toolbox' 'Aerospace_Toolbox' 'aero'
'Antenna Toolbox' 'Antenna_Toolbox' 'antenna'
'Audio System Toolbox' 'Audio_System_Toolbox' 'audio'
'Bioinformatics Toolbox' 'Bioinformatics_Toolbox' 'bioinfo'
'Communications System Toolbox' 'Communication_Toolbox' 'comm'
'Computer Vision System Toolbox' 'Video_and_Image_Blockset' 'vision'
'Control System Toolbox' 'Control_Toolbox' 'control'
'Curve Fitting Toolbox' 'Curve_Fitting_Toolbox' 'curvefit'
'DSP System Toolbox' 'Signal_Blocks' 'dsp'
'Data Acquisition Toolbox' 'Data_Acq_Toolbox' 'daq'
'Database Toolbox' 'Database_Toolbox' 'database'
'Datafeed Toolbox' 'Datafeed_Toolbox' 'datafeed'
'Deep Learning Toolbox' 'Neural_Network_Toolbox' 'nnet'
'Econometrics Toolbox' 'Econometrics_Toolbox' 'econ'
'Embedded Coder' 'RTW_Embedded_Coder' 'embeddedcoder'
'Financial Instruments Toolbox' 'Fin_Instruments_Toolbox' 'fininst'
'Financial Toolbox' 'Financial_Toolbox' 'finance'
'Fixed-Point Designer' 'Fixed_Point_Toolbox' 'fixedpoint'
'Fuzzy Logic Toolbox' 'Fuzzy_Toolbox' 'fuzzy'
'Global Optimization Toolbox' 'GADS_Toolbox' 'globaloptim'
'Image Acquisition Toolbox' 'Image_Acquisition_Toolbox' 'imaq'
'Image Processing Toolbox' 'Image_Toolbox' 'images'
'Instrument Control Toolbox' 'Instr_Control_Toolbox' 'instrument'
'MATLAB' 'MATLAB' 'general'
'MATLAB Coder' 'MATLAB_Coder' 'matlabcoder'
'MATLAB Compiler' 'Compiler' 'compiler'
'MATLAB Report Generator' 'MATLAB_Report_Gen' 'rptgen'
'Mapping Toolbox' 'MAP_Toolbox' 'map'
'Model Predictive Control Toolbox' 'MPC_Toolbox' 'mpc'
'Neural Network Toolbox' 'Neural_Network_Toolbox' 'nnet'
'Optimization Toolbox' 'Optimization_Toolbox' 'optim'
'Parallel Computing Toolbox' 'Distrib_Computing_Toolbox' 'distcomp'
'Partial Differential Equation Toolbox' 'PDE_Toolbox' 'pde'
'Phased Array System Toolbox' 'Phased_Array_System_Toolbox' 'phased'
'Polyspace Bug Finder' 'PolySpace_Bug_Finder' 'psbugfinder'
'Polyspace Bug Finder' 'PolySpace_Bug_Finder_Engine' 'psbugfinder'
'Polyspace Code Prover' 'PolySpace_Server_C_CPP' 'pscodeprover'
'RF Blockset' 'RF_Blockset' 'rfblks'
'RF Toolbox' 'RF_Toolbox' 'rf'
'Robotics System Toolbox' 'Robotics_System_Toolbox' 'robotics'
'Robust Control Toolbox' 'Robust_Toolbox' 'robust'
'Signal Processing Toolbox' 'Signal_Toolbox' 'signal'
'SimBiology' 'Simbiology' 'simbio'
'SimEvents' 'SimEvents' 'simevents'
'Simscape' 'Simscape' 'simscape'
'Simscape Driveline' 'SimDriveline' 'sdl' %possibly 'simdrive'
'Simscape Electronics' 'SimElectronics' 'elec'
'Simscape Fluids' 'SimHydraulics' 'fluids'
'Simscape Multibody' 'SimMechanics' 'mech'
'Simscape Power Systems' 'Power_System_Blocks' 'sps'
'Simulink' 'SIMULINK' 'simulink'
'Simulink 3D Animation' 'Virtual_Reality_Toolbox' 'sl3d'
'Simulink Coder' 'Real-Time_Workshop' 'simulinkcoder'
'Simulink Control Design' 'Simulink_Control_Design' 'slcontrol'
'Simulink Design Optimization' 'Simulink_Design_Optim' 'sldo'
'Simulink Desktop Real-Time' 'Real-Time_Win_Target' 'sldrt'
'Simulink Real-Time' 'XPC_Target' 'xpctarget' %probably incorrect
'Simulink Report Generator' 'SIMULINK_Report_Gen' 'rptgenext'
'Spreadsheet Link' 'Excel_Link' 'excellink'
'Stateflow' 'Stateflow' 'stateflow'
'Statistics and Machine Learning Toolbox' 'Statistics_Toolbox' 'stats'
'Symbolic Math Toolbox' 'Symbolic_Toolbox' 'symbolic'
'System Identification Toolbox' 'Identification_Toolbox' 'ident'
'Trading Toolbox' 'Trading_Toolbox' 'trading'
'Vehicle Network Toolbox' 'Vehicle_Network_Toolbox' 'vehiclenetwork' %probably incorrect
'Vision HDL Toolbox' 'Vision_HDL_Toolbox' 'vision-hdl' %probably incorrect
'Wavelet Toolbox' 'Wavelet_Toolbox' 'wavelet' };
This was derived by:
1) fileread() one of my .lic files; regexp() with 'tokens' twice, once concentrating on =product= which is followed by a single word product description, and once concentrating on ="product= which is followed by a multi-word product description until the first " . In either case, the name for license() purposes is immediately after the word INCREMENT in the file. Then the multi-word descriptions need to be filtered to remove literal \ followed by newline followed by spaces. Put everything together into N x 2 cell array.
2) hack ver.m . If you which ver you might get ver.p but it turns out that calls ver.m which you can find the location of with which -all ver . There is a routine locParseContentsFiles which uses which to look for all Contents.m files. It then reads through those files and looks for ones in a specific format. The ones that it finds, it adds to a struct. The hack is to pull apart the file name to extract the last directory before the 'Contents.m' part and to record it in the struct as well. Run ver() assigning the output to a variable, which will become a struct. Extract the Name field and the field that you saved the directory name.
3) create two tables from the two respective information sources, giving the same variable name to the product description from the first license information, and to the Name field from the result of ver(). Now innerjoin() the two tables; the common key will be used automatically. table2cell() the results of the innerjoin() to get the information as above.
breathi on 22 Jan 2020
Hey Walter,
you could add the following products to your list:
AUTOSAR Blockset AUTOSAR_Blockset
Filter Design HDL Coder Filter_Design_HDL_Coder
Filter Design Toolbox Filter_Design_Toolbox
IEC Certification Kit Cert_Kit_IEC
MATLAB Compiler SDK MATLAB_Builder_for_Java <-- unsure about this one
Simulink Check SL_Verification_Validation
Simulink Code Inspector Simulink_Code_Inspector
Simulink Coverage Simulink_Coverage
Simulink Design Verifier Simulink_Design_Verifier
Simulink Requirements Simulink_Requirements
Simulink Test Simulink_Test
Predictive Maintenance Toolbox Pred_Maintenance_Toolbox

Sign in to comment.

More Answers (4)

Julian Hapke
Julian Hapke on 4 May 2020
Edited: Julian Hapke on 5 May 2020
Here's what I use:
EDIT: Now all features known to the current release are listed, not only the installed ones.
function OUT = getFeatureName(fullname)
% getFeatureName - translates a toolbox name from 'ver' into
% a feature name and vice versa, also checks license availability
% Syntax:
% getFeatureName(fullname)
% Inputs:
% fullname: character vector of toolbox name as listed in ver
% output (optional, if none given all features are
% listed)
% Outputs:
% translation: cell array with clear name, feature name and license
% availability
% Version 1.1
% 2018.09.04 Julian Hapke
% 2020.05.05 checks all features known to current release
assert(nargin < 2, 'Too many input arguments')
% defaults
checkAll = true;
installedOnly = false;
if nargin
checkAll = false;
installedOnly = strcmp(fullname, '-installed');
if checkAll || installedOnly
allToolboxes = com.mathworks.product.util.ProductIdentifier.values;
nToolboxes = numel(allToolboxes);
out = cell(nToolboxes, 3);
for iToolbox = 1:nToolboxes
marketingName = char(allToolboxes(iToolbox).getName());
flexName = char(allToolboxes(iToolbox).getFlexName());
out{iToolbox, 1} = marketingName;
out{iToolbox, 2} = flexName;
out{iToolbox, 3} = license('test', flexName);
if installedOnly
installedToolboxes = ver;
installedToolboxes = {installedToolboxes.Name}';
out = out(ismember(out(:,1), installedToolboxes),:);
if nargout
OUT = out;
out = [{'Name', 'FlexLM Name', 'License Available'}; out];
productidentifier = com.mathworks.product.util.ProductIdentifier.get(fullname);
if (isempty(productidentifier))
warning('"%s" not found.', fullname)
OUT = cell(1,3);
feature = char(productidentifier.getFlexName());
OUT = [{char(productidentifier.getName())} {feature} {license('test', feature)}];
Julian Hapke
Julian Hapke on 5 May 2020
Regarding the Names: I guess it's history. The license feature got the marketing name with underscores instead of whitespace but then marketing changed the feature name, but it stayed the same on the license service. E.g.
Then it was "Real-Time Windows Target", now it's "Simulink Desktop Real-Time" but the feature name was always "Real-Time_Win_Target".

Sign in to comment.

Jan on 18 Jan 2018
You have to rely on something. Because this is not trivial, when the names or key changes, writing your own function might be the easiest way:
function hasToolbox = CheckToolbox(Feature)
persistent ExistingToolboxes
if isempty(ExistingToolboxes)
PrefFile = fullfile(prefdir, '');
if exist(PrefFile, 'file') % Preferences file is existing already:
FileData = load(PrefFile, '-MAT');
ExistingToolboxes = FileData.ExistingToolboxes;
else % Need to create new preferences file:
ExistingToolboxes = SelectToolboxesGUI({});
% Allow to open the GUI to select toolboxes manually:
if strcmpi(Feature, 'LetMeChoose')
ExistingToolboxes = SelectToolboxesGUI(ExistingToolboxes)
hasToolbox = any(strcmpi(Feature, ExistingToolboxes);
function ExistingToolboxes = SelectToolboxesGUI(ExistingToolboxes)
... A tiny GUI to select existing toolboxes ...
Now it is up to the user to find out, if the needed license are installed. You can add a list of known feature keys also for a useful error message, if somebody asks for the CrystalBall or DWIM toolboxes. But you cannot check, if there is a license available in case of concurrent licenses with this tool yet.
Well, the problem is not solved by this function. It was hard to check the Matlab version already, when they hopped from the R6.5 scheme to R2007b, and after the problems to distinguish version 7.1 and 7.10. Sometimes functions are moved from a specific toolbox to Matlab's standard toolboxes, and then a rejected check for a toolbox can be too strict, when a function could work.

Thomas Pfau
Thomas Pfau on 18 Jan 2018
First of all, thanks for the answer. I feared something like this, so yes, I'll probably have to keep my own toolbox / license feature mapping.... information (which is a pain).

Jerry George
Jerry George on 18 Jun 2019
Edited: Jerry George on 18 Jun 2019
You can use the following commands to list the features available as per your license:
text = fileread(fullfile(matlabroot,'licenses','license.dat'));
expression = '(?<=INCREMENT )\w*';
matches = regexp(text,expression,'match');

Community Treasure Hunt

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

Start Hunting!