Adding axes title using my GUI popupmenu

6 visualizaciones (últimos 30 días)
Sophie Stoneley
Sophie Stoneley el 7 de Mayo de 2016
Comentada: Sophie Stoneley el 8 de Mayo de 2016
I want to add a graph title in my GUI including the names that are within my popupmenu. How would i code this?

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 8 de Mayo de 2016
Sophie - if we assume that your GUI has (at least) a popup menu and an axes (and that the GUI has been created in GUIDE), then I would use the popup menu callback to update the axes title whenever the user selects a new menu item. For example,
function popupmenu1_Callback(hObject, eventdata, handles)
itemStrings = get(hObject,'String');
selectedItem = get(hObject,'Value');
title(handles.axes1,itemStrings{selectedItem});
The above assumes that your popup menu is tagged/named popupmenu1 and your axes is named axes1. Try the above and see what happens!
  1 comentario
Sophie Stoneley
Sophie Stoneley el 8 de Mayo de 2016
i tried this and it worked perfectly! Thank you so much Geoff!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects 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