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 Center および File ExchangeManage Products についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by