How to add constant line in appdesigner

45 ビュー (過去 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 Center および File ExchangeSpecifying 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