Activate license checkout from script/command
24 views (last 30 days)
Show older comments
Is there anyway to enable license checkout from a command instead of via: Help -> Licensing -> Borrow License.
Once enabled with Borrow Product Licenses Automatically a simple script can check out the needed features
featureStr = {'Aerospace_Blockset'; ...
'Aerospace_Toolbox'; ...
'Bioinformatics_Toolbox'; ...
'Communication_Blocks'; ...
'Communication_Toolbox'; ...
'Compiler'};
index = cellfun(@(f) license('checkout', f), availableFeatures);
checkedOutFeatures = availableFeatures(logical(index));
However, there is still the initial manual step (which can be forgotten). This is an issue for long simulation (20h+) and working via VPN since a refresh of VPN connection will result in inability for matlab.exe to periodically validate against the license server and terminate these long simulation.
Being able to add a couple of commands at the start of a configuration.m to initiate a borrow+features is the safest way to ensure contiguous simulation
0 Comments
Answers (1)
Simar
on 5 Oct 2023
Edited: Simar
on 5 Oct 2023
Hi Jonathan,
I understand that you are looking for a way to enable automatic license borrowing via a command or script in MATLAB, rather than manually through the GUI.
Unfortunately, Programmatic borrowing of licenses is limited. The license borrowing process is designed to be initiated manually through the MATLAB interface. This is because borrowing a license is a significant action that can affect other users' ability to use the software, so it is not something that should be done lightly or automatically.
However, one can automate the license checkout process for specific toolboxes using the “license('checkout', feature)” command, as showed in your script. This will ensure that the necessary licenses are checked out before long-running simulations begin.
If MATLAB sessions are being terminated due to VPN disconnections, you might want to consider other solutions. For example, run your MATLAB sessions on a machine that has a direct (non-VPN) connection to the license server. Alternatively, work with your IT Admin to enable uninterrupted VPN settings to avoid undesired disconnects.
Hope it helps!
Best Regards,
Simar
0 Comments
See Also
Categories
Find more on Manage Products in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!