MATLAB: How to retrive the chosen value from SelectionChangeFcn (GUI)

button groupguiselectionchangefcn

Hello!
I need the value chosen in a GUI button group for a function later in my code, but when i try to retrive it with:
kr =str2double(get(handles.Load,'string'))
I get this error message:
Error using uitools.uibuttongroup/get
The name 'string' is not an accessible property for an instance of class 'uibuttongroup'.
uibuttongroup apperantly doesnt like me calling the value a 'string', but it didnt work when i changed it to 'value' either.
My code from the button group:
function Load_SelectionChangeFcn(hObject, eventdata, handles)
B=str2num(get(handles.breadth,'string')) ;% inserted in a edit box
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
case 'radiobutton1_kr'
val=str2num(get(handles.calckr,'string')); %if already calculated
kr=val*B;
case 'radiobutton2_kr'
kr=0.39*B;
case 'radiobutton3_kr'
kr=0.35*B;
case 'radiobutton4_kr'
kr=0.25*B;
end
Im new to using GUI, and havent got the hang of it yet. Hope the question is understandable and that someone can help me.
-Lina

Best Answer

I found out that putting
handles = guidata(hObject);
before the switch command and
set(handles.shiptype,'UserData',st);
after the end command, makes it possible to call the value in another function in the program using
St=get(handles.shiptype,'UserData');