How do I correlate a scalar value to a dropdown menu item?

조회 수: 2 (최근 30일)
Mariano Longo
Mariano Longo 2021년 3월 25일
댓글: Mariano Longo 2021년 3월 27일
I am trying to code a takeoff performance calculator tool. The user needs to select the type of engine installed on the aircraft (IAE or CFM in this case) so that the app can run the code with the appropriate max thrust. I have therefore set up the app to do the following:
However, this yields the following result:
which means that now only "IAE" has an ItemData value, which is "1,2". I thought I could put a temporary fix to this by having the user input "1" from the dropdown menu as the IAE engine type and "2" as the CFM engine type, then figure out later what is going on. However, I quickly noticed that in this line of code here, the "If" condition is never met, because further down the code, "Thrust" simply cannot be found. What am I doing wrong?
if app.EnginesDropDown.Value==1
Thrust=110310*(exp((-10^(-4)*DA)))
elseif app.EnginesDropDown.Value==2
Thrust=124511*(exp((-10^(-4)*DA)));
end

채택된 답변

Mario Malic
Mario Malic 2021년 3월 27일
Hello,
Leave the Value field empty, it will be the first value of Items. For ItemsData, use a new row to define ItemsData for each entry of Items.
When you click on ItemsData, it should look like this
1
2
  댓글 수: 1
Mariano Longo
Mariano Longo 2021년 3월 27일
Thanks for your help, I tried that, didn't work, however installing the newest version of Matlab fixed it

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by