How can I make a slider from App Designer change the background of a shape which is loaded from a text file, whilst moving it?
6 次查看(过去 30 天)
显示 更早的评论
How can I make a slider from App Designer change the background of a shape which is loaded from a text file, whilst moving it?
6 个评论
Voss
2021-12-4
I'm not sure what that for loop is supposed to do. It looks like the entire loop can be replaced with this line:
fill(app.Canvas, coordinates_x, coordinates_y, cName{1+changingValue});
and it'll do the same thing. (Note that the code inside the loop doesn't depend on the loop index ind or the variable color in any way, so it will just do the same thing over and over several times.)
Regardless, the fact that the fill is always yellow indicates that changingValue is always 0 (or at least it is never 1, 2, or 3). Perhaps print the value of changingValue to the command line from within the callback and make sure you get the values you expect when interacting with the slider.
Adam Danz
2021-12-4
I suggest using a discrete knob since you're referencing a discrete list of colors. Alternatively, see this answer to learn how to make a continuous slider behave as if it were discrete.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!