programmatic GUI callback function
Show older comments
I want to access the GUI control from the call back function. how can I do this. I got the below code from Matlab help but it gives an error when executed. How can I access the slider from the call back function.
function mygui()
figure
uicontrol('Style','slider','Callback',@display_slider_value);
end
function display_slider_value(hObject,callbackdata)
newval = num2str(hObject.Value);
disp(['Slider moved to ' newval]);
end
Accepted Answer
More Answers (1)
Sean de Wolski
on 24 Dec 2014
0 votes
I fyou're using a version of MATLAB < R2014b, hObject.Value won't work. That syntax is added in R2014b.
If your company/university if current on maintenance, you should be able to upgrade at no additional cost. If not, use get(hObject,'Value')
1 Comment
Chandrasekhar
on 24 Dec 2014
Categories
Find more on Interactive Control and Callbacks 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!