Clear Filters
Clear Filters

App designer app calls sub apps, better to leave as .mlapp or compile each one to .exe?

6 views (last 30 days)
I'm designing an app in app designer. It calls several sub apps. Some of these do their own processes, some of them are simply complex dialogue boxes.
At the moment, when I run the app in App designer to test it out, all the apps are still in .mlapp format. My question is, when I finally compile my main app should I compile each sub app separately myself and include their .exes in the file list? Or leave them in .mlapp format and let the compiler deal with them? Does it make a difference?
  1 Comment
Neurolab
Neurolab on 29 Mar 2024
For an example of a dialogue box sub app you can see this Mathworks walkthrough, but it doesn't mention what to do when it comes to compiling the app(s):
https://www.mathworks.com/help/matlab/creating_guis/creating-multiwindow-apps-in-app-designer.html

Sign in to comment.

Accepted Answer

Eric Delgado
Eric Delgado on 1 Apr 2024
Edited: Eric Delgado on 1 Apr 2024
Yes, there's a significant difference! Keeping the files as .MLAPP means only one session of the MATLAB Runtime will run on the user's machine.
However, if you directly compile auxiliary modules and include their .EXE in your project, calling a .EXE module will create a separate session of MATLAB Runtime each time. Consequently, you won't have a handle for the auxiliar app, preventing information exchange between your main app and the auxiliar one.
Beyond that, this would lead to a poor user experience, given that the MATLAB Runtime takes between 10 and 20 seconds to load.
  2 Comments
Neurolab
Neurolab on 1 Apr 2024
At the moment the parent app is passed as an input argument to the sub-app, you are saying that if the sub app is compiled separately this will no longer work? Is there any way to alert the parent app that the sub app has completed it's task?
10-20 seconds might not actually be a problem because the sub app only needs to be called once and is expected to be doing it's task for a little while.
Eric Delgado
Eric Delgado on 1 Apr 2024
Edited: Eric Delgado on 1 Apr 2024
Unfortunately, calling a .EXE file (created in MATLAB) initiates a new process (MATLAB Runtime) in your operating system. For this reason, you lose access to the app's public properties and methods within this new process.
If you proceed with this approach, you'd be forced to rely on mechanisms like external files or tcp-sockets to facilitate information exchange between applications running in different processes of your operating system. However, I don't think this is a good ideia! :)
I forgot to answer your last question ("Is there any way to alert the parent app that the sub app has completed it's task?"). So... maybe the answer that you are looking for is here: https://www.mathworks.com/help/matlab/ref/parallel.pool.dataqueue.html

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!