Check whether a license is available.

조회 수: 161 (최근 30일)
Ernst Reissner
Ernst Reissner 2022년 7월 18일
댓글: Walter Roberson 2022년 7월 22일
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?

답변 (1개)

Walter Roberson
Walter Roberson 2022년 7월 18일
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
Ernst Reissner
Ernst Reissner 2022년 7월 21일
편집: Ernst Reissner 2022년 7월 21일
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 2022년 7월 22일
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)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Manage Products에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by