How to retrive the chosen value from SelectionChangeFcn (GUI)
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!