How to continuously change the plotted data according to the value obtained from a "uislider" component?
Show older comments
The following code should change the y-value of the plotted horizontal line according to the value obtained from the "uislider" component continuously. But the obtained values seem to be incorrect and lagging behind the position of the slider.
f = uifigure('Position',[10 10 500 800]);
a = uiaxes('Parent',f,'Position',[10 10 480 700]);
s = uislider('Parent',f,'Position',[10 760 400 10]);
p = plot(a,[0 4],[4 4]);
s.ValueChangingFcn = @updatePlot;
function updatePlot(src,event)
src.Parent.Children(2).Children.YData(:) = src.Value;
end
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing 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!