Check whether a license is available.

148 vues (au cours des 30 derniers jours)
Ernst Reissner
Ernst Reissner le 18 Juil 2022
Commenté : Walter Roberson le 22 Juil 2022
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?

Réponses (1)

Walter Roberson
Walter Roberson le 18 Juil 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')
ans = 1
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 commentaires
Ernst Reissner
Ernst Reissner le 21 Juil 2022
Modifié(e) : Ernst Reissner le 21 Juil 2022
Someone removed my answer to the original answer of Walter Robertson.
This is not helpful.
If there is a list of names of licenses and MATLAB is among them,
and if one may invoke
license('test', 'MATLAB')
and if matlab quits if running out of licenses,
then if a result is given at all, this is always 1, right?
I know that there are installations not using lmutil.
This would be important.
Walter Roberson
Walter Roberson le 22 Juil 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)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Manage Products dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by