How to install a .mltbx without opening Licence Agreement Screen?

8 次查看(过去 30 天)
Hello dear community!
I want to install GUI Layout Toolbox inside a function with only code. I am currently using 2018a and earlier versions. I have already downloaded both .zip file and .mltbx file from FEX. (version 2.3.4)
I have extracted .zip file and added the codes folder inside my main app folder and added all folders and subfolders into Matlab path with addpath. I runned my app's main function which includes constructGUI.m method which creates a figure and moves the figure center with movegui.
It gave me the error below:
Error using get (line 13)
uiextras.get has been removed.
Error in matlab.ui.internal.legacyMoveGUI (line 88)
old0units = get(0, 'Units');
Error in movegui (line 125)
matlab.ui.internal.legacyMoveGUI(fig, position);
The reason of this error I think is the set.m and get.m functions inside the GUI Layout Toolbox's uiextras folder. Those two contradict with Matlab's built-in set&get methods.
So my question is How can I install it without opening the licence agreement screen? And get rid of the above error?
Here is my code below:
function mainGUI = mainFunc()
addpath([cd,'\','creatorGUI']);
addpath([cd,'\','helperGUI']);
verStruct = ver('layout'); % checks if GUI Layout Toolbox is installed
if isempty(verStruct)
fullToolboxPath = [cd, '\GUI Layout Toolbox 2.3.4.mltbx'];
newAddon = matlab.addons.install(fullToolboxPath,true); % this does not work in 2018a
%% there should be some code here to add gui layout toolbox functions in Add-Ons folder if it exists.
end
% this section detects if my app is already open and if it is not, creates my main GUI.
if isempty(findall(0,'Tag','MainFigure'))
appObj = View.myApp();
mainGUI = appObj.constructGUI;
else
warndlg('App is already open', 'Warning!','modal');
end
end
I really apreciate your help. Thank you very much for your time.

采纳的回答

Luna
Luna 2019-3-4
I found a way,
newAddon = matlab.addons.toolbox.installToolbox(fullToolboxPath,true);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by