How to integrate license file into GUI?

조회 수: 1 (최근 30일)
adi kul
adi kul 2016년 5월 31일
댓글: Image Analyst 2020년 6월 10일
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.

답변 (1개)

Walter Roberson
Walter Roberson 2016년 5월 31일
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
zaiani mohamed
zaiani mohamed 2020년 6월 10일
what chek_license contains ?
Image Analyst
Image Analyst 2020년 6월 10일
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.

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

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by