MATLAB: How to install a .mltbx without opening Licence Agreement Screen

addonsinstallationMATLABmltbxtoolbox

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.

Best Answer

I found a way,
newAddon = matlab.addons.toolbox.installToolbox(fullToolboxPath,true);