Modify Knob From App Designer

7 ビュー (過去 30 日間)
Sossio Del Prete
Sossio Del Prete 2020 年 9 月 3 日
コメント済み: Geoff Hayes 2020 年 9 月 8 日
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 日
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 件のコメント
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?
Geoff Hayes
Geoff Hayes 2020 年 9 月 8 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by