- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
AppDesigner in headless mode (without GUI)
7 次查看(过去 30 天)
显示 更早的评论
(Matlab 2022b)
How can we run Matlab in headless mode (without display and user input) when it uses AppDesigner?
-------------------------------------------------------------------------
The application is build on AppDesigner and that is interwined in an object oriented code that stores data in the app from Appdesigner.
The application is complex and contains not only the GUI but many important functions, hence, we do not want to rewrite it.
Further, we have to maintain the version with GUI for some customers but need the headless mode for internal batch processing on Linux.
My prefered option would be to run the application as usual but without output on a display (as there is no display).
That would still allow to store data in the app (in the figures) and would need minimal code change.
(Matlab2022b is fixed as the developer left and stated that it does not run on newer versions)
Any suggestion here is welcome. Thanks in advance.
0 个评论
采纳的回答
Hassaan
2024-1-18
Is a bit tricky, especially since AppDesigner is primarily designed for GUI-based applications. However, there are a few strategies you might consider. Keep in mind that these methods may require some code adaptation and are not 100% gauranted of what you want to achieve:
Invisible Figures: Set the 'Visible' property of figures to 'off'. This keeps the figures and GUI elements active in the code but does not display them.
MATLAB Nodisplay Mode: Use the -nodisplay option when running MATLAB on Linux. This launches MATLAB without its desktop interface, though its effectiveness with AppDesigner applications might vary.
Separating Logic from GUI: Refactor the code to decouple the core functionalities from the GUI components. This allows the non-GUI parts of the application to run in headless mode.
Virtual Framebuffer (Xvfb): On Linux, use Xvfb to create a dummy display. This allows GUI applications to run in a headless environment as if they were connected to a monitor.
Code Modification for Batch Processing: Adjust the application to detect a 'headless' mode on startup. In this mode, the application would bypass GUI initialization but still perform computations and data storage.
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Feel free to contact me.
0 个评论
更多回答(1 个)
Rik
2024-1-18
I'm not aware of a way to use an AppDesigner app without the app, so I doubt you will like my suggestion:
You should extract the processing from the AppDesigner file and move it to its own file. That way you can write a class that replicates the properties stored in the graphics object. This structure will allow you to run the same processing code by either passing in the app object as an input argument, or an instance of the dummy class as an input argument. The processing code need not be aware of the difference.
This will be a lot of work, but will do exactly what you need.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!