How can I modify the Knob from code-wiew in the App Designer through a callback, for example I would like to set the fixed values of the knob only multiples of 2 (example: 2 ^ 1, 2 ^ 2, 2 ^ 3, 2 ^ 4) and the space between them without changing their numerical value.

 채택된 답변

Geoff Hayes
Geoff Hayes 2020년 9월 3일

1 개 추천

Sossio - I suspect that you will want to create a discrete uiknob. Perhaps something like the following will do
fig = uifigure;
kb = uiknob(fig, 'discrete');
kb.Items = split(num2str(2.^[1:4]));
kb.ItemsData = {2 4 8 16};
The above simplifies (somewhat) what you want to do as you would want to access the kb via the App object (I'm guessing) in whatever callback you wish to make this change.

댓글 수: 3

Sossio Del Prete
Sossio Del Prete 2020년 9월 7일
편집: Sossio Del Prete 2020년 9월 7일
Thanks
Geoff Hayes
Geoff Hayes 2020년 9월 8일
Sossio's answer moved here
I have to do the same thing with the slider, is it possible with the same code?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 9월 3일

댓글:

2020년 9월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by