Uses of handles value in GUI
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I'm having trouble using GUIDE.
I'm currently working on an interface with togglebuttons and axes. I would like to reset properly the axes properties when pushing back togglebuttons.
Each of my 3 togglebuttons plot curves on the axis. I would like my axes properties to reset when I pushback the togglebutton and when there is no other curve on the axes (= when other toggebuttons value are 0).
This is a part of the code on my togglebutton1_Callback function :
if get(hObject,'Value')
grid on; hold all; box on; set(gca,'fontsize',11,'FontName','Garamond');
xlabel('Déformation [mm/mm]','fontsize',14)
ylabel('Module de Young [GPa]','fontsize',14)
axis([0,inf,0,150])
for i=1:handles.n
handles.h3(i)=plot(handles.X1(:,i),handles.Z(:,i),'.'); %Curve
handles.h4(i)=handles.essais(i).SpecID; %For legend, currently not used
iscell(handles.h2(i));
end;
else
set(handles.h3(:),'Visible','off');
if handles.togglebutton2==0 && handles.togglebutton3==0
reset(handles.axes1);
end
end
guidata(hObject,handles);
handles.h3(:) is the handle referring to the plot, containing severals curves.
I have some trouble with this. The handles have different values at the beginning : (=> not equal to 0)
- togglebutton1=180.0065
- togglebutton 2=181.0065
- togglebutton3=182.0065
- axes1=174.0065.
Where do the values come from? Do I have to set all the handles to zero first in the openingFct function? And how?
(Sorry for my English, it's not my native langage).
See my .fig below :
0 comentarios
Respuestas (1)
Mathieu
el 9 de Mzo. de 2016
Editada: Mathieu
el 9 de Mzo. de 2016
Hello,
It is normal your three togglebuttons have different handles. It is like this Matlab know what object is used during an event (for example when you push your button). It is the same for all the curve in your axe, each one have different handles.
I assume your axe is named h3, so you try to hide your axe before to clean it?
Personnally, I designed a GUI in which I clean all my axes with cla and not reset because the function is made for axes.
For me, h3(:) contains all the properties of your axe, including the curves (as children). So if you want to clean your axe, for me you just have to do cla(h3, 'reset') to reset all properties of your axe as the beginning.
Ver también
Categorías
Más información sobre Specifying Target for Graphics Output 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!