I want to add a graph title in my GUI including the names that are within my popupmenu. How would i code this?
Best Answer
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/namedpopupmenu1 and your axes is namedaxes1. Try the above and see what happens!
That should give you a list ofall the items in the popup. I'm surprised it gives you an error. Even if it's empty I would think it would return null, []. What does the error message say exactly?
Best Answer