App Designer, addlistener for slider
12 次查看(过去 30 天)
显示 更早的评论
Hi,
I want to update some plots when a slider control is moved, but i want it to update continuously when the slider is dragged. Is it possible to add a listener for the slider in the AppDesigner like with the usual uicontrol, as app.Slider.addlistener('Value', 'PostSet', @(es,ed)update_plot(es,ed,'zeta'));
However, i get an error: Error using matlab.ui.control.Slider/addlistener While adding a PostSet listener, property 'Value' in class 'matlab.ui.control.Slider' is not defined to be SetObservable.
Error in app1 (line 203) runStartupFcn(app, @startupFcn)
Do i have to do it differently?
Sincerely, Rasmus
3 个评论
Adam
2018-7-6
App Designer still has a lot of limitations compared to regular Matlab code or Guide. I guess this is one of them. It seems the 'value' for these sliders is not setup to have observers.
You can use a java slider to achieve continuous callbacks, but it does involve more work and I've never tried including them in App Designer because I 'rage quit' last time I tried to create even a basic UI in App Designer!!
采纳的回答
Madeline Gardner
2018-7-6
Hello!
It looks like App designer has a ValueChanging callback for a slider that gets the value continuously as the slider updates! The syntax is a little different than the code you're referencing, but it should have the same output. This link has some information, but you can also go to callbacks under Slider Properties and select the ValueChangingFcn option. (I've attached just a basic screenshot of what this looks like in the App Designer interface)
Hope that helps!
2 个评论
Mihail Dadun
2019-11-11
I've encountered the same problem and the ValueChanging (as opposed to ValueChanged) callback still does not provide continuous updates. As in, it updates (the value, implicitly the plot) just once, the only difference being that it does change it before the click release. However, if I keep sliding, it does not produce any results, until I release the click, click again, and briefly slide again. Could this be a bug?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!