GUIDE: set handle with function
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Dear all;
I'm building a GUI with GUIDE and I have few tables. Now, for every each one of those tables I want to set the data according to different conditions (related to a different popup assigned to each table) and if the conditions are the same for two different tables then the data I'm setting are the same for the two tables. Now, to do so, it would be nice if I could use the same function for all of those table. What I have so far is this (for table 1 taken as an example):
function popupmenu1_Callback(hObject, eventdata, handles)
val1 = get(hObject,'Value');
table1(val1,handles)
And inside the function called table1 I have:
function [a]=table1(val1,handles)
if val1 == 1
set(handles.uitable1,'Data',list_a,'Enable','off')
elseif val1 == 2
set(handles.uitable1,'Data',list_b,'Enable','on')
elseif val1 == 3
[...]
Now, for the other tables I have the same thing but instead of calling the function table1 I'm calling table2, table3 and so forth which in turn will set handles.uitable2, handles.uitable3 and so on...
Now, is there any way to generalize this and have only one function instead of table1, table2, table3??
Thank you all!
0 comentarios
Respuestas (1)
Image Analyst
el 7 de Jul. de 2013
Sure, just have one function called "SetAllTables" and call that in every function of every control (popup) that needs to do this. In the SetAllTables you can just do all three tables. No need to have one function per table if you don't want to.
8 comentarios
Image Analyst
el 9 de Jul. de 2013
If you want, you can make a function that takes a handle and a popup selection number and send those to a function. But you still have to put a call to that function inside each callback of each popup.
Ver también
Categorías
Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!