Greetings.
I am trying to add a user defined variable to the "hObject" Handles via two radio buttons.
The radio button calling is here:
set(handles.boardsize,'SelectionChangeFcn',@boardsize_SelectionChangeFcn);
The actual code that uses "setappdata is here:
function boardsize_SelectionChangeFcn(hObject, eventdata)%retrieve GUI data, i.e. the handles structure
handles = guidata(hObject); switch get(eventdata.NewValue,'Tag') % Get Tag of selected object
case 'button5800' %execute this code when 5800 is selected
setappdata(hObject,'boardtype',0) disp('this is working') case 'button9800' %execute this code when 9800 is selected
setappdata(hObject,'boardtype',1) disp('this is working') otherwise % Code for when there is no match.
end%updates the handles structure
guidata(hObject, handles);
Then later on I try and get the add data within the main function
boardsize = getappdata(hObject,'boardtype')
But the board type variable is always empty "[]" Am I updating the wrong handles? This one has had me for a while. Thanks to all who look at it.
Best Answer