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

조회 수: 1 (최근 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 CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by