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

22 次查看(过去 30 天)
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 个评论
Neurolab
Neurolab 2024-3-29
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

请先登录,再进行评论。

采纳的回答

Eric Delgado
Eric Delgado 2024-4-1,3:55
编辑:Eric Delgado 2024-4-1,3:56
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 个评论
Neurolab
Neurolab 2024-4-1,4:26
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 2024-4-1,5:32
编辑:Eric Delgado 2024-4-1,5:34
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by