Creating Variable from app.dropdowmenu.value

1 次查看(过去 30 天)
Hi, please i need help in creating a variable from user selection in drop down menu.
Example
%I tried this but not working
app.SelectInputDataDropDown.Value = %some equation

回答(1 个)

Image Analyst
Image Analyst 2021-6-22
编辑:Image Analyst 2021-6-22
It's the other way around. The app.SelectInputDataDropDown.Value expression is the user's selection, so to assign that to some variable you want, you have to put it on the right hand side of the equation, like
temperatureInCelsius = app.SelectInputDataDropDown.Value;
temperatureInFahrenheit = (9/5) * temperatureInCelsius + 32;
or perhaps if you want the contents of the list rather than it's index, you can do
allItems = app.SelectInputDataDropDown.String;
selectedIndex = app.SelectInputDataDropDown.Value;
temperatureInCelsius = str2double(allItems{selectedIndex});
temperatureInFahrenheit = (9/5) * temperatureInCelsius + 32;
  5 个评论
chizom wornu
chizom wornu 2021-6-22
The sim() function is used to run a simulink model. I am trying to assign the simulate output to the selected dropdown value
Image Analyst
Image Analyst 2021-6-22
I don't have Simulink so I can't help you, but good luck with it.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simulink 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by