MATLAB: Package app with multiple GUIs

app designerMATLABmatlab appmultiple gui'spackage app

Hi have coded an app that employs several UI figures as well as multiple functions, and I would to package it to a mlapp.install file. To do so, I open the starting app in the App Designer, click on "Share", "Matlab App". As the main file I have said app and, as the dependency analysis does not return any files, I include all the other apps and functions on shared resources. However, once I have installed the app and run it, it does not find any of the apps or functions that were included in shared resources.
It has to be a Matlab App, not a standalone program. Thank you.

Best Answer

After a lot of digging around, here's my final answer.
  1. Files are not being identified automatically because the app names are strings. Remove the run commands and just call the apps by name.
  2. Do not delete the main app. This clears the app files from the path, breaking the app. Instead, change the visibility of TA1 ('on' and 'off'). You can delete the supporting apps as you do. It is just the main app that must persist.
  3. To change the visibility, create a public function in TA1 that sets the visibility on or off. Other apps will be able to access this function.
  4. For the function to work, you must pass in the app structure of TA1 as the first argument. Use this documentation page as an example of how to do that. Basically, add an input argument to all the apps that can connect back to TA1 (TA2, TA3, TA4, TA12, TA13, TA14, TA15). We can name the input mainapp. We also need to add a property to these apps - name it CallingApp - as well as the following to the startupFcn: app.CallingApp = mainapp;
I created a public function called TA1Visible to hide TA1 if val is 0, and otherwise show it.
methods (Access = public)
function TA1Visible(app,val)
switch lower(val)
case {0,'false','no'}
app.InicioAvion.Visible = 'off';
otherwise
app.InicioAvion.Visible = 'on';
end
end
end
To call this function from within TA1, I'd do the following (to hide TA1 and show the next mlapp). Note that I am passing app as an input when calling TA12. This gets assigned to app.CallingApp in TA12. The next step shows why.
% Button pushed function: SeleccionaravinButton
function SeleccionaravinButtonPushed(app, event)
TA1Visible(app,0);
TA12(app)
end
To call this function from outside TA1, I'd do the following (to delete TA12 and show TA1). Note that now I call TA1Visible with app.CallingApp as input, or the original app structure of TA1.
% Button pushed function: VolverButton

function VolverButtonPushed(app, event)
TA1Visible(app.CallingApp,1)
delete(app)
end
To maintain access to the public function in TA1, and ultimately the visible property of TA1, we need to maintain access to the app structure of TA1. Therefore, we need to pass app.CallingApp as input to all mlapps that have a pathway of returning the user to TA1. This is how I would call TA3 from TA2, since TA3 can return the user to TA1.
% Pasamos a la siguiente ventana
TA3(app.CallingApp)
delete(app)
In TA3, app.CallingApp gets assigned to mainapp, which in turn gets assigned internally to app.CallingApp. Then, if the user clicks on 'Volver' in TA3, the callback can return them to TA1:
% Button pushed function: VolverButton
function VolverButtonPushed(app, event)
TA1Visible(app.CallingApp,1)
delete(app)
end
That's a lot to follow, so I'm also attaching the modified files.