Pushbutton callback not working
5 views (last 30 days)
Show older comments
I am working on a gui which is composed of 2 listbox and 2 pushbutton ok and cancel. The first part of my programe calculate the items that will go in the listboxes. The next part allow the user when he press on ok to get the number of the selected elements in each listbox and return it in an excel file. I put an exemple of what it is supposed to do (exemple is the gui and exemple 2 is the function that run it)
My exemples work great but the actual program when it comes to the part with the switch (all the above works fine) :
function res=kgexec4e(cn,OptPref)
%kgexec4e Création de la boite de dialogue "Choix Export" associée à
%kgexec4
% Detailed explanation goes here
persistent res1 Varlist1 Varlist2%[] Initialement
%Appel du menu
h0 = kgui4e
%Calcul contenue listbox barre
Varlist1 = cn.Barres.Nom(1:end);
if OptPref.CacheBarr
Varlist1=Varlist1(~strncmp(Varlist1,'@',1)); %suppression des noms auto en fonction du menu Pref
end
%Calcul contenue listbox Element
Varlist2 = cn.Elements.Nom(1:end);
if OptPref.CacheElem
Varlist2=Varlist2(~strncmp(Varlist2,'@',1)); %suppression des noms auto en fonction du menu Pref
end
%%%Mise à jour contenu des listboxs
set(findobj(h0,'Tag','Barres'),'String',Varlist1)
set(findobj(h0,'Tag','ELement'),'String',Varlist2)
res = res1
switch get(h0,'Tag')
case 'OptOK'
nb = get(findobj(h0,'Tag','Barres'),'Value')
ne = get(findobj(h0,'Tag','ELement'),'Value')
end
end
it always gives me this error which i don't understand as the part of this programe that is slightly different from the exemple works but the similar part won't work.
here is the error message : (kguie is the gui which is the exact same as exemple gui)
Error in Caviar\private\kgui4e (line 5)
gris=[0.75 0.75 0.75];
Output argument "h0" (and maybe others) not assigned
during call to
"C:\Users\223080038\Documents\m\CAVIAR3.1.2
_m_original\R2012a\Caviar\private\kgui4e.m>kgui4e".
Error in kgexec4e (line 8)
h0 = kgui4e
Error while evaluating uicontrol Callback
Accepted Answer
More Answers (0)
See Also
Categories
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!