Duplicated elements in a GUI
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Dear all, I have a gui with 20 different tables. They all perform the same calculation with the data entered in each one of them by the user.
At the moment I have this in my function:
function uitable1_CellEditCallback(hObject, ~, handles)
calculation
function uitable2_CellEditCallback(hObject, ~, handles)
calculation
function uitable3_CellEditCallback(hObject, ~, handles)
calculation
Any chance to do that in a cleaner way without having to repeat the same block of code over and over?
Thanks!
0 Kommentare
Antworten (4)
Sean de Wolski
am 8 Nov. 2013
Absolutely.
You can go into GUIDE and use the property inspector to change the callback manually. Copy the callback from the first UITABLE's GUIDE Inspector window and paste it into the others. Now you'll have one callback for all of them and have them all point at it.
Inside of the Callback, the first input hObject is the handle to the specific uitable that is calling the callback. Thus if you need some logic based on the calling uitable, you have it there.
0 Kommentare
Shaun VanWeelden
am 8 Nov. 2013
Have them all point to the same callback and use the hObject variable to differentiate them. hObject is the current object being used and you can do your get/set stuff based on the hObject
0 Kommentare
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps 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!