How to read the data in app design.

2 views (last 30 days)
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni on 15 Apr 2024
Edited: Voss on 15 Apr 2024
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 Comments
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni on 15 Apr 2024
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 on 15 Apr 2024
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?

Sign in to comment.

Accepted Answer

Voss
Voss on 15 Apr 2024
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 Comments
Vaibhavi Pallavaneni
Vaibhavi Pallavaneni on 15 Apr 2024
Thank you very much Voss for your help.
Voss
Voss on 15 Apr 2024
Edited: Voss on 15 Apr 2024
You're welcome! Any questions, let me know.

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!