Need help using menu option

5 views (last 30 days)
Brian
Brian on 14 Oct 2013
Answered: Image Analyst on 15 Oct 2013
choice1=menu('Choose first color of resistor','BLACK','BROWN','RED','ORANGE','YELLOW','GREEN','BLUE','VIOLET','GRAY','WHITE');
I am trying to assign these colors a certain value for each one. I want the menu to display the color names as well.

Answers (1)

Image Analyst
Image Analyst on 15 Oct 2013
Try this:
userSelection = menu('Choose first color of resistor',...
'BLACK','BROWN','RED','ORANGE','YELLOW',...
'GREEN','BLUE','VIOLET','GRAY','WHITE')
value = userSelection - 1
Your menu buttons already do display the color names, so there's nothing additional needed for that.

Tags

Community Treasure Hunt

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

Start Hunting!