Getting the default radio button value from a button group
Mostrar comentarios más antiguos
Hello!
I'm making a gui with multiple button groups that define values which is to be used in a function triggered by a push button.
My problem is that when I want the default radio button in the button group, I must "activate" it by pressing another button first, and then choosing it, else the value ends up empty.
Simplification of the code:
function indata2_OpeningFcn(hObject, ~, handles, varargin)
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
function RUNpush_Callback(~, eventdata, handles)
St=get(handles.shiptype,'UserData');
%Send values into function
FunctionoutsideGUI(St)
%One of the button groups:
function shiptype_SelectionChangeFcn(hObject, eventdata, handles)
handles = guidata(hObject);
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
case 'St1'
st=1;
case 'St2'
st=2;
end
set(handles.shiptype,'UserData',st);
guidata(hObject,handles)
Hope someone can help me, Im realy struggeling with this, and I want to get it rigth.
-Lina
Respuestas (1)
Categorías
Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!