フィルターのクリア

How to link functionality of Plot "Linewidth" with Knobvalue in appdesigner Matlab (R2020a)

3 ビュー (過去 30 日間)
if we have to variable data
app.a = [1 2 3] % used with property
app.b = [4 5 6] % used with property
we use plot(a,b) and to add line width we use plot(a,b,"LineWidth",2)
now i want to link it with Knob value so end user may set Linewidth while Plotting.
in "Plot" push button callbak i wrote
app.G = app.Knob.Value
then
plot(a,b,"LineWidth",app.G)
but this is not working gives error "values not a numeric Scalor"
Kindly suggest Solution. Thanks

採用された回答

Adam Danz
Adam Danz 2020 年 10 月 17 日
編集済み: Adam Danz 2020 年 10 月 17 日
It looks like you're using a discrete knob which returns a character vector in its 'value' property. Here are some options.
1. Convert the discrete knob numeric-string to a number.
value = str2double(app.Knob1.Value);
2. Use a continuous knob which returns a numeric value.
  3 件のコメント
taimour sadiq
taimour sadiq 2020 年 10 月 17 日
編集済み: taimour sadiq 2020 年 10 月 17 日
Method 2 is Working... Thanks Again Dear

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by