How to integrate license file into GUI?

1 visualización (últimos 30 días)
adi kul
adi kul el 31 de Mayo de 2016
Comentada: Image Analyst el 10 de Jun. de 2020
Hello, I am developing the GUI for a script. For this I want to have a license time check. For this simple purpose I have created license.m with following function:
function output = license(varargin)
if now > datenum('2017-01-01') % this code stops working Jan 1, 2017
h = msgbox('Please update your License','License Expired') ;
return
end
end
Now I need help in calling this file in my Matlab GUI script. I want to have this check at beginning of the execution.

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de Mayo de 2016
If you are using GUIDE then look in the generated code, and put your call to your license check just before the line
% Begin initialization code - DO NOT EDIT
  5 comentarios
zaiani mohamed
zaiani mohamed el 10 de Jun. de 2020
what chek_license contains ?
Image Analyst
Image Analyst el 10 de Jun. de 2020
chek_license contains these lines of code:
if now > datenum('2017-01-01') % this code stops working Jan 1, 2017
h = msgbox('Please update your License','License Expired') ;
quit
end
A better way would be this:
% Check that user has the specified Toolbox installed and licensed.
hasLicenseForToolbox = license('test', 'matlab'); % Check for base MATLAB.
% hasLicenseForToolbox = license('test', 'Image_Acquisition_Toolbox'); % Check for Image Acquisition Toolbox.
% hasLicenseForToolbox = license('test', 'Statistics_Toolbox'); % Check for Statistics and Machine Learning Toolbox.
% hasLicenseForToolbox = license('test', 'Signal_Toolbox'); % Check for Signal Processing Toolbox.
% hasLicenseForToolbox = license('test', 'Video_and_Image_Blockset'); % Check for Computer Vision System Toolbox.
% hasLicenseForToolbox = license('test', 'Neural_Network_Toolbox'); % Check for Deep Learning Toolbox.

Iniciar sesión para comentar.

Categorías

Más información sobre Manage Products en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by