Good day, How can I create a push button that creates a new variable every time the user presses the button in App designer?

5 ビュー (過去 30 日間)
The application is based on a floor plan simulator where the user would input the dimensions of rooms into a numberic edit fields. The push button is used as a "draw button" to draw a rectangle on a UI axis. I would like to implemement the same "draw" button for when the user presses the button it stores the inputed values/dimensions into a new varaible(eg room1,room2,etc). The file atteched is my UI design.

採用された回答

Srijith Kasaragod
Srijith Kasaragod 2021 年 11 月 22 日
編集済み: Srijith Kasaragod 2021 年 11 月 22 日
Hi Kyle,
Creating dynamic variables could lead to your code being inefficient and affect its readability. A better practice would be to use arrays or strucutres in declaring your variables. Please refer 'this' answer to read more on why creating dynamic variables is not a recommended approach.
Incase you wish to proceed with dynamic variables, 'eval' function can be used to create them. Please refer 'this' answer to know more on its usage.
  1 件のコメント
Kyle Ramphal
Kyle Ramphal 2021 年 11 月 22 日
編集済み: Kyle Ramphal 2021 年 11 月 22 日
Good day, I didnt think about using dynmaic varibales thank you for the response!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by