How to read the data in app design.

2 ビュー (過去 30 日間)
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni 2024 年 4 月 15 日
編集済み: Voss 2024 年 4 月 15 日
I have created an app, If i give numeric input value, that many tabs are generating and also I have given callback functions to generate some uilabels and texts. I want to generate dynamic input boxes inside the tabs. For example: Number of Boxes : 10, I'm able to generate 10 tabs. In those tabs I made UIedit texts as No. of Bags: and enter button. If i give No.of bags as 5 and click enter button. I should generate 5 dynamic input boxes. For reference, i have attached MATLAB files.
  3 件のコメント
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni 2024 年 4 月 15 日
As in design view the callback function can read the numeric value. But when it comes inside the tab why it cannot able to read the value? And also can u suggest any alternative for these kind of problems.
Rik
Rik 2024 年 4 月 15 日
I have trouble understanding what you mean. If you have the exact handle to an object, you should be able to read that value, regardless of your context.
I would suggest writing a programmatic GUI. If you like AppDesigner, you might prefer using a handle class as a basis. Otherwise, you can write functions and use the guidata function to store and retrieve values. I also explain this in the thread I linked. Have you read it?

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

採用された回答

Voss
Voss 2024 年 4 月 15 日
The problem is that you are storing each "Number of Bags" edit field as app.EditField_1. That is, you give them all the same name, so that when the second one is created, the first one is no longer accessible by the name "app.EditField_1", etc., so that really only the last one created is stored as app.EditField_1 after that function completes.
Instead, you can store them in an array. (And use the Box index you are passing to your callback to access the correct one, e.g., "app.editFields(Box)".) See the attached mlapp file for an example of that (and other changes as well).
  2 件のコメント
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni 2024 年 4 月 15 日
Thank you very much Voss for your help.
Voss
Voss 2024 年 4 月 15 日
編集済み: Voss 2024 年 4 月 15 日
You're welcome! Any questions, let me know.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by