How do I handle multiple components and callbacks in app designer?
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shabnam Noor
am 20 Sep. 2023
Bearbeitet: Cris LaPierre
am 20 Sep. 2023
I am using the Knob and the Slider components in App Designer and I want to use a separate Edit Field box for each to display the values as I change them. I managed to use the callback function to do this for the Knob but when I try to do the same thing for the Slider, the value gets displayed on the same Edit Field box. I want to display the values on separate Edit Field boxes, rather than sharing the same one.
I am having the same problem with multiple Switch and Lamp combinations. I have 2 switches and a separate lamp for each of them but again, the two switches seem to be sharing the same lamp. How do I separate them?
2 Kommentare
Akzeptierte Antwort
Cris LaPierre
am 20 Sep. 2023
Bearbeitet: Cris LaPierre
am 20 Sep. 2023
Each component has its own name. You need to update your code to refer to the specific component. You can view the name(s) in the Component Browser.

In your case, you have componenets app.Lamp and app.Lamp_2, but your code only ever refers to app.Lamp. Update one of your callbacks to use app.Lamp_2.
The same thing is happening with your edit fields. You have componenets app.EditField and app.EditField_2, but your code only uses app.EditField.
2 Kommentare
Dyuman Joshi
am 20 Sep. 2023
Accepting the answer indicates that your problem has been solved (which can be helpful to other people in future) and it awards the volunteer with reputation points for helping you.
You can accept only 1 answer for a question, but you can vote for as many answers as you want. Voting an answer also provides reputation points.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!