App Designer: Drop down menu values

I have a drop down menu with 10 different options. I need a statement that will give me different values based on the option picked. I know it is probably really straight forward and easy, but i just don't get it.

답변 (1개)

ES
ES 2017년 11월 10일

3 개 추천

Get the value of the selected option from drop down menu callback using Value property.
Value will be the index of selected option.
Using this Value property, you can index and select from your list of values.

댓글 수: 5

Ryan Browning
Ryan Browning 2017년 11월 10일
This is confusing. How do i figure out the values of each option?
Can you give me an example of what a code inside of the drop down menu callback should look like with say 3 different options so i can get a refrence?
Nevermind I figured it out. Thanks for the help!
app.val = app.Carrier.Value;
if strcmp(app.val,'Select one') %app.val is the option the user picked
set(app.Panel1,'visible','on') %I have a panel that says you need to pick a different option
elseif strcmp(app.val,'AT&T') %This compares the two strings, app.val(User input) and 'AT&T'(one of the options) if it is the same then it does said action after
app.c = ('@txt.att.net')
elseif strcmp(app.val,'Boost Mobile')
app.c = ('@myboostmobile.com')
%more elseif's til i finish
else
set(app.Panel1,'visible','on')
end
Thank you again, I put this code just in case anyone wants to know in the future.
Kallol Bera
Kallol Bera 2019년 4월 1일
편집: Kallol Bera 2019년 4월 1일
@Ryan Browning
Thank you, you saved my day.
Robert Pritchard
Robert Pritchard 2019년 4월 2일
Me too lol. what are the chances 2 people who need this stumbled upon it a year and half later on the same day
rajatajay thakur
rajatajay thakur 2020년 6월 28일
What if I have images like peppers or cameraman in that option and I need to display that image on axes when selected please help

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

질문:

2017년 11월 10일

댓글:

2020년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by