How to create a GUI in App Designer starting from existing code

21 ビュー (過去 30 日間)
Michael
Michael 2025 年 8 月 8 日
コメント済み: Michael 2025 年 8 月 11 日
I am attempting to use AI to generate an initial design for a GUI. I would like to copy the code that is generated and input it directly into the Code View of the App Designer. I would then like to make further adjustments using some of the App Designer tools (i.e. Design View). However, I cannot copy the code directly over, as App Designer doesn't let the user edit portions of the code. Is there a way to edit the grayed-out code? Or a way to easily integrate the generated code into an .mlapp file?

採用された回答

Jacob Mathew
Jacob Mathew 2025 年 8 月 10 日
I tried to edit the greyed out parts of the App Designer Code. Unfortunately even MATLAB Documentation regarding Manage Code in App Designer Code View also notes that some sections of the code are not editable which are generated and managed by App Designer. You can cross reference the documentation below:
A workaround would be to first setup the UI to your liking with the neccessary components. Then to prompt the AI tool you are using to give the code broken down into various callback functions. You can create those callbacks and then copy paste the code into them.
  1 件のコメント
Michael
Michael 2025 年 8 月 11 日
Yeah, I was hoping there would be an easier way, but this sounds like the best option available.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2025 年 8 月 10 日
Are you saying that you used some AI tool to build an .mlapp file that had all the buttons, listboxes, etc. made to your liking? (The .mlapp file is a binary file, by the way, not a text file, until it's brought into appdesigner) And that .mlapp file had code in the gray, uneditable portions that specified properties for components like size, location, color, value, items, etc.?
Well, if it's a valid .mlapp file that your AI tool made, then you can open it up with AppDesigner and then change the properties that you want to change in the properties panel (below the list of components in the upper right). The callback code of those components can be edited directly in the Code View window (they'll be white) but the properties (that code will have a gray background) must be edited in the properties panel in the lower right of your screen.
  3 件のコメント
Image Analyst
Image Analyst 2025 年 8 月 11 日
You build the app as you like it in appdesigner, with all the buttons, etc. Then copy and paste the code that your AI tool generated into the callbacks. Right click on a component (like a button) and tell it to create a callback and then paste your code into it. If you want non-callback functions then you can use the Code panel on the left side to create a new private function and then paste your AI code into that. Neither of those two situations will have grayed out code that you can't paste into.
Michael
Michael 2025 年 8 月 11 日
Makes sense. Thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by