How to read the data in app design.

2 次查看(过去 30 天)
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
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 个评论
Voss
Voss 2024-4-15
编辑:Voss 2024-4-15
You're welcome! Any questions, let me know.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Introduction 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