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
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
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File 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!