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!