GUIDE: Duplicated elements without duplicated functions
1 view (last 30 days)
Show older comments
Lorenzo on 4 Feb 2014
Answered: David Sanchez on 4 Feb 2014
Dear all, I'm writing a GUI in GUIDE with a lot of duplicated elements. I have 20 tables and 20 textboxes. Depending on the data entered in table_i the value of text_box_i is updated accordingly. Every text box depends on the corrisponding table only and the calculation behind each table+text_box pairing is the same.
What I have at the moment is:
function uitable_1_CellEditCallback(hObject, ~, handles)
This is for table+text_box 1. Since I have 20 pairings, this is repeated 20 times thus making my code long and boring to modify (every small change has to be repeated 20 times...)
Since the only change in the code is the number of the table (which is the same number for the text box), I was wondering if there was any way to do this by having one piece of code only. Something such as (but of course different than):
function uitable_i_CellEditCallback(hObject, ~, handles)
David Sanchez on 4 Feb 2014
Every object within your GUI has to have its own callback function, and these have to be defined in your code. You have to code all your callbacks.
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!