![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220852/image.jpeg)
How to add constant line in appdesigner
21 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Daniel Boateng
le 24 Mai 2019
Modifié(e) : Kojiro Saito
le 24 Mai 2019
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?
0 commentaires
Réponse acceptée
Kojiro Saito
le 24 Mai 2019
Modifié(e) : Kojiro Saito
le 24 Mai 2019
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/220852/image.jpeg)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!