Creating Variable from app.dropdowmenu.value
古いコメントを表示
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
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
2021 年 6 月 22 日
chizom wornu
2021 年 6 月 22 日
Image Analyst
2021 年 6 月 22 日
I don't know what the sim() function is, but I doubt that would work. sim() looks like a function call where you're passing it lots of parameters. If so, you can't do that. For example, plot is a function and you can't set it equal to a control's value or anything else, so you cannot do
plot(x, y) = 42; % Not valid.
I suspect your line of code is similar.
chizom wornu
2021 年 6 月 22 日
Image Analyst
2021 年 6 月 22 日
I don't have Simulink so I can't help you, but good luck with it.
カテゴリ
ヘルプ センター および File Exchange で Matrix Indexing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!