Adding axes title using my GUI popupmenu

조회 수: 6 (최근 30일)
Sophie Stoneley
Sophie Stoneley 2016년 5월 7일
댓글: Sophie Stoneley 2016년 5월 8일
I want to add a graph title in my GUI including the names that are within my popupmenu. How would i code this?

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 5월 8일
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
Sophie Stoneley
Sophie Stoneley 2016년 5월 8일
i tried this and it worked perfectly! Thank you so much Geoff!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by