license

Reports license information, or tests whether a product license is available.

Category: Environment and Settings > Platform and License

Syntax

license

Returns the license number or type of the running MATLAB.

tf = license('test', feature)

Returns true if a license for feature exists, for example 'MATLAB' or 'Statistics_Toolbox'.

tf = license('checkout', feature)

Tries to check out a license and returns whether it succeeded.

Description

Scripts use license('test', ...) to guard code that needs a toolbox, so they can offer a fallback instead of failing in the middle of a computation. The feature names are the license identifiers of each product, which are not always the same as the product's display name.

MatLivre recognizes only itself: license returns 'MatLivre', license('test', 'MATLAB') is true, and toolbox features such as 'Statistics_Toolbox' give false.

Input arguments

feature
License name of a product or toolbox.

Output arguments

tf
1 when the license is available, 0 otherwise.

Example

Guarded call

try
  ok = license('test', 'MATLAB')
catch err
  disp(err.message)
end
Output
ok = 1

See also

ver version isstudent usejava