Check whether a license is available.
162 views (last 30 days)
Show older comments
For testing we run as many matlab instances as possible.
How can we find out that no license is available?
At best without starting matlab.
But if we have to start matlab: what is a save way to check whether a license is available or not?
0 Comments
Answers (1)
Walter Roberson
on 18 Jul 2022
Once you are in MATLAB, to check whether a toolbox license is available, you can use license('test') . For example,
license('test', 'Symbolic_Toolbox')
The names you have to use are not always obvious; I listed as many names as I could find in https://www.mathworks.com/matlabcentral/answers/449314-how-do-features-from-license-correspond-to-names-from-ver?s_tid=srchtitle
If you are using a license manager, then you can look at license usage using lmutil with the lmstats command or possibly using a GUI; see https://sites.math.washington.edu/~reu/codes/Matlab/Matlab%201/jhelp/base/install/pc/ch3_li12.html
4 Comments
Walter Roberson
on 22 Jul 2022
I think your comment is still at https://www.mathworks.com/matlabcentral/answers/1763205-check-whether-a-license-is-available#comment_2277655 ? You might need to "Show older comments" to see it.
You cannot use the license() command to test for a MATLAB license until after you have started MATLAB, but you cannot start MATLAB unless there is an available license.
The lmutil lmstat is a utility that is not part of MATLAB, but which can talk to the license server to find out licenses in use. It will not tell you directly how many licenses are available -- you have to look at the line such as
Users of MATLAB: (Total of 5 licenses available)
If you are using Standalone Named User licenses (license resides on host, no license server) and the processes are all being launched by the same username, then it is not clear to me whether the limit applies. In such a situation you could potentially find out how many are already executing using taskmgr (Windows) or ps (MacOS or Linux)
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!