How do features from 'license' correspond to names from 'ver'
214 次查看(过去 30 天)
显示 更早的评论
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 https://nl.mathworks.com/help/matlab/ref/license.html 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?
1 个评论
Gareth
2024-1-16
When I read this type of question, I wonder what is driving it? In my experience one reason is that people are trying to parse the license manager debug file to derive usage of the different toolboxes. If this is the case feel free to search for companies that do this: https://www.versionbay.com/products/toolbox-usage-analyzer-flexinspect/
Disclaimer: I work for the company that makes this product. That being said we created it just because there several organizations / people trying to do this, which probably is not their day job.
采纳的回答
Walter Roberson
2018-1-18
编辑:Walter Roberson
2019-2-14
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.
7 个评论
Walter Roberson
2019-10-4
That's what I have recorded, Jon:
'Image Processing Toolbox' 'Image_Toolbox' 'images'
breathi
2020-1-22
编辑:breathi
2020-6-8
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
更多回答(5 个)
Julian Hapke
2020-5-4
编辑:Julian Hapke
2020-5-5
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');
end
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);
end
if installedOnly
installedToolboxes = ver;
installedToolboxes = {installedToolboxes.Name}';
out = out(ismember(out(:,1), installedToolboxes),:);
end
if nargout
OUT = out;
else
out = [{'Name', 'FlexLM Name', 'License Available'}; out];
disp(out)
end
else
productidentifier = com.mathworks.product.util.ProductIdentifier.get(fullname);
if (isempty(productidentifier))
warning('"%s" not found.', fullname)
OUT = cell(1,3);
return
end
feature = char(productidentifier.getFlexName());
OUT = [{char(productidentifier.getName())} {feature} {license('test', feature)}];
end
end
3 个评论
Julian Hapke
2020-5-5
Thanks :)
Yes, I did write that. I found the essential parts by stepping through
ver -support
Julian Hapke
2020-5-5
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. https://web.archive.org/web/20000815202232/http://www.mathworks.com/products/
Then it was "Real-Time Windows Target", now it's "Simulink Desktop Real-Time" but the feature name was always "Real-Time_Win_Target".
Jan
2018-1-18
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, 'CheckToolbox.data');
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({});
end
end
% Allow to open the GUI to select toolboxes manually:
if strcmpi(Feature, 'LetMeChoose')
ExistingToolboxes = SelectToolboxesGUI(ExistingToolboxes)
else
hasToolbox = any(strcmpi(Feature, ExistingToolboxes);
end
end
function ExistingToolboxes = SelectToolboxesGUI(ExistingToolboxes)
... A tiny GUI to select existing toolboxes ...
end
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.
0 个评论
Jerry George
2019-6-18
编辑:Jerry George
2019-6-18
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');
disp(matches');
1 个评论
Walter Roberson
2019-6-18
The license files are not always in that location; see https://www.mathworks.com/matlabcentral/answers/99147-where-are-the-license-files-for-matlab-located and https://www.mathworks.com/help/install/ug/understanding-license-files.html
Qingyang Du
2022-7-18
5G_Toolbox
Aerospace_Blockset
Aerospace_Toolbox
Antenna_Toolbox
Audio_System_Toolbox
Audio_Toolbox
Automated_Driving_System_Toolbox
Automated_Driving_Toolbox
AUTOSAR_Blockset
Bioinformatics_Toolbox
Bluetooth_Toolbox
CDMA_Reference_Blockset
Communications_Blockset
Communications_System_Toolbox
Communications_Toolbox
Computer_Vision_System_Toolbox
Computer_Vision_Toolbox
Control_System_Toolbox
Curve_Fitting_Toolbox
Data_Acquisition_Toolbox
Database_Toolbox
Datafeed_Toolbox
DDS_Blockset
Deep_Learning_HDL_Toolbox
Deep_Learning_Toolbox
Distributed_Computing_Toolbox
DO_Qualification_Kit
DSP_HDL_Toolbox
DSP_System_Toolbox
Econometrics_Toolbox
EDA_Simulator_Link
EDA_Simulator_Link_DS
EDA_Simulator_Link_IN
EDA_Simulator_Link_MQ
Embedded_Coder
Embedded_IDE_Link
Embedded_IDE_Link_CC
Embedded_IDE_Link_MU
Embedded_IDE_Link_TS
Embedded_IDE_Link_VS
Embedded_Target_for_Infineon_C166_Microcontrollers
Embedded_Target_for_Motorola_HC12
Embedded_Target_for_Motorola_MPC555
Embedded_Target_for_OSEK_VDX
Embedded_Target_for_TI_C2000_DSP
Embedded_Target_for_TI_C6000_DSP
Excel_Link
Extended_Symbolic_Math_Toolbox
Filter_Design_HDL_Coder
Filter_Design_Toolbox
Financial_Derivatives_Toolbox
Financial_Instruments_Toolbox
Financial_Time_Series_Toolbox
Financial_Toolbox
Fixed_Income_Toolbox
Fixed_Point_Designer
Fixed_Point_Toolbox
Fixed-Income_Toolbox
Fixed-Point_Designer
Fixed-Point_Toolbox
Fuzzy_Logic_Toolbox
GARCH_Toolbox
Gauges_Blockset
Genetic_Algorithm_and_Direct_Search_Toolbox
Global_Optimization_Toolbox
GPU_Coder
HDL_Coder
HDL_Verifier
IEC_Certification_Kit
Image_Acquisition_Toolbox
Image_Processing_Toolbox
Industrial_Communication_Toolbox
Instrument_Control_Toolbox
Lidar_Toolbox
Link_for_Code_Composer_Studio
Link_for_ModelSim
Link_for_TASKING
LTE_HDL_Toolbox
LTE_System_Toolbox
LTE_Toolbox
Mapping_Toolbox
MATLAB
MATLAB_Builder_EX
MATLAB_Builder_for_.NET
MATLAB_Builder_for_COM
MATLAB_Builder_for_Excel
MATLAB_Builder_for_Java
MATLAB_Builder_for_Java_Language
MATLAB_Builder_JA
MATLAB_Builder_NE
MATLAB_Coder
MATLAB_Compiler
MATLAB_Compiler_SDK
MATLAB_Distributed_Computing_Engine
MATLAB_Distributed_Computing_Server
MATLAB_Parallel_Server
MATLAB_Production_Server
MATLAB_Report_Generator
MATLAB_Web_App_Server
MATLAB_Web_Server
Mixed_Signal_Blockset
Mixed-Signal_Blockset
Model_Based_Calibration_Toolbox
Model_Predictive_Control_Toolbox
Model-Based_Calibration_Toolbox
Motor_Control_Blockset
Navigation_Toolbox
Neural_Network_Toolbox
OPC_Toolbox
Optimization_Toolbox
Parallel_Computing_Toolbox
Partial_Differential_Equation_Toolbox
Phased_Array_System_Toolbox
Polyspace_Bug_Finder
Polyspace_Bug_Finder_Server
Polyspace_Code_Prover
Polyspace_Code_Prover_Server
Powertrain_Blockset
Predictive_Maintenance_Toolbox
Radar_Toolbox
Real_Time_Windows_Target
Real_Time_Workshop
Real_Time_Workshop_Embedded_Coder
Real-Time_Windows_Target
Real-Time_Workshop
Real-Time_Workshop_Embedded_Coder
Reinforcement_Learning_Toolbox
Requirements_Toolbox
RF_Blockset
RF_PCB_Toolbox
RF_Toolbox
Risk_Management_Toolbox
Robotics_System_Toolbox
Robust_Control_Toolbox
ROS_Toolbox
Satellite_Communications_Toolbox
Sensor_Fusion_and_Tracking_Toolbox
SerDes_Toolbox
Signal_Integrity_Toolbox
Signal_Processing_Blockset
Signal_Processing_Toolbox
SimBiology
SimDriveline
SimElectronics
SimEvents
SimHydraulics
SimMechanics
SimPowerSystems
SimRF
Simscape
Simscape_Driveline
Simscape_Electrical
Simscape_Electronics
Simscape_Fluids
Simscape_Multibody
Simscape_Power_Systems
Simulink
Simulink_3D_Animation
Simulink_Accelerator
Simulink_Check
Simulink_Code_Inspector
Simulink_Coder
Simulink_Compiler
Simulink_Control_Design
Simulink_Coverage
Simulink_Design_Optimization
Simulink_Design_Verifier
Simulink_Desktop_Real_Time
Simulink_Desktop_Real-Time
Simulink_Fixed_Point
Simulink_HDL_Coder
Simulink_Parameter_Estimation
Simulink_PLC_Coder
Simulink_Real_Time
Simulink_Real-Time
Simulink_Report_Generator
Simulink_Requirements
Simulink_Response_Optimization
Simulink_Test
Simulink_Verification_and_Validation
SoC_Blockset
Spline_Toolbox
Spreadsheet_Link
Spreadsheet_Link_EX
Stateflow
Stateflow_Coder
Statistics_and_Machine_Learning_Toolbox
Statistics_Toolbox
Symbolic_Math_Toolbox
System_Composer
System_Identification_Toolbox
SystemTest
Target_for_Freescale_MPC5xx
Target_for_Infineon_C166
Target_for_TI_C2000
Target_for_TI_C6000
Target_Support_Package
Target_Support_Package_FM5
Target_Support_Package_IC1
Target_Support_Package_TC2
Target_Support_Package_TC6
Text_Analytics_Toolbox
Trading_Toolbox
UAV_Toolbox
Vehicle_Dynamics_Blockset
Vehicle_Network_Toolbox
Video_and_Image_Processing_Blockset
Virtual_Reality_Toolbox
Vision_HDL_Toolbox
Wavelet_Toolbox
Wireless_HDL_Toolbox
Wireless_Testbench
WLAN_System_Toolbox
WLAN_Toolbox
xPC_Target
xPC_Target_Embedded_Option
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Deep Learning with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!