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?

조회 수: 13 (최근 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
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
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개)

Shanmukha Voggu
Shanmukha Voggu 2021년 12월 29일
Hi,
The above problem can be solved by using
2)As Adam said try this to make a continuous slider as if it were discrete
3)If you are dealing with integers as ticks try rounding to nearest integer while sliding.
Refer to the this for more information

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by