Hi all,
I'm new to GUI and learning from GUI examples in MATLAB's help.
When I type a variable in command window, it shows that the variable is not valid.
As a part of GUI example in MATLAB help, how could I return the value of the variable 'contents' in the following code?
function popupmenu1_Callback(hObject, eventdata, handles)% hObject handle to popupmenu1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu1
contents = get(hObject,'String'); selectedText = contents{get(hObject,'Value')};colormapStatus = [selectedText ' colormap'];set(handles.textStatus, 'string', colormapStatus);colormap(selectedText)
Thanks.
Khanh
Best Answer