How to add constant line in appdesigner

조회 수: 54 (최근 30일)
Daniel Boateng
Daniel Boateng 2019년 5월 24일
편집: Kojiro Saito 2019년 5월 24일
I want to add a constant line in the plot axes in appdesigner. I tried the command plot(app.UIAxes,xline(app.DCValueDropDown.Value)) where the drop down values are values from (10 to 20). But it isnt working. Any ideas please?

채택된 답변

Kojiro Saito
Kojiro Saito 2019년 5월 24일
편집: Kojiro Saito 2019년 5월 24일
Data type of dropdown.Value is a character, so you need to covert it to number.
The following will work. Please replace "plot" command depending on your data.
function startupFcn(app)
plot(app.UIAxes, 1:20, 1:20)
app.xl = xline(app.UIAxes, str2double(app.DCValueDropDown.Value));
end
function DCValueDropDownValueChanged(app, event)
value = app.DCValueDropDown.Value;
% Change xline value
app.xl.Value = str2double(value);
end
Below is a preview.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Specifying Target for Graphics Output에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by