Borrar filtros
Borrar filtros

Needs Checkbox to draw a plot

1 visualización (últimos 30 días)
Aleksandra
Aleksandra el 14 de Jun. de 2012
Hi all, Can you help me with GUI? So I need to create checkbox to draw a plot by clicking mouse on it. How can I do it?

Respuesta aceptada

John
John el 14 de Jun. de 2012
Write an if statement that gets the value of the checkbox. When the checkbox's value is 1 then plot. This snip of code would have to be written under the function of the checkbox.
for example if the checkbox's tag is 'checkbox1' then:
if get(handles.checkbox1,'Value') == 1
plot(......)
end
  3 comentarios
John
John el 18 de Jun. de 2012
The if statement takes care of that. It will only plot when the checkbox is highlighted
Aleksandra
Aleksandra el 25 de Jun. de 2012
Got it. Thanks a lot.

Iniciar sesión para comentar.

Más respuestas (1)

Benjamin Schwabe
Benjamin Schwabe el 14 de Jun. de 2012
Hi Aleksandra,
I am not sure where you are stuck, so I try to be a little more detailed than John.
Use GUIDE to design you GUI with drag and drop. Save the GUI. Then double click on the checkbox and the m-File openes at the callback function of the ckechbox. Then use the if statement as John suggests.
Benjamin
  1 comentario
Aleksandra
Aleksandra el 15 de Jun. de 2012
Thanks a lot.
But how do not plot if the checkbox is not highlighted?

Iniciar sesión para comentar.

Categorías

Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by