Performance-wise, should I create my App Interactively using app designer or code it from the startupFcn(app)?

2 次查看(过去 30 天)
I am creating an application in MATLAB r2020b, which has a lot og UI elements (mainly uibuttons and uitextarea). I have a total of ~1000 elements organized in a gridlayout.
I am creating all the elements programatically in the startupFcn(app), but It takes a long time to open the app (~1 min).
Would it improve the perfomance of my app if I create all the elements interactively using app designer???

回答(1 个)

Jacob Mathew
Jacob Mathew 2024-5-10
After reading through your question, I believe you want to compare the performance difference of programmatically adding elements to the app versus designing them using the App Designer interactive UI.
I have created an app shown below which comprises of several buttons and test area, which you have mentioned forms a large part of your app. Further, I have aligned them using a grid box as well, all interactively.
However, if you look at the code view:
Under the hood, App Designer converts your interactive UI element placement and properties into code as well. This ensures that the code it generates is optimised and only the necessary updates to the app are done. However, this auto generated code is not editable which could be a deal breaker if you have lots of custom coding to generate the UI elements.
Hence while there will be noticeable performance improvements as App Designer will load the UI elements in the initialisation function before rending them, they will not be drastic since fundamentally both are the same under the hood. However, there are perks like easier UI design and manipulation and limitations like lack of editing of UI elements when they are being initialised.

类别

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

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by