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 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