Matalab popup menu problem

3 views (last 30 days)
Usama Khan
Usama Khan on 17 May 2014
Edited: Jan on 18 May 2014
hello guys i have made a GUI with popup menus with numbers written from 0 to 12 for months i am using Month1 = get(handles.txtmonths1,'Value'); to read the values but it is reading 0 as 1. PLz someone help my project is due today. thank you

Answers (2)

Image Analyst
Image Analyst on 17 May 2014
That is the index of the popup item that was selected, not the text of the item itself. To get that you need to get the contents and index it with the value you got
selectedItem = get(handles.txtmonths1,'Value'); % Get index of selection.
contents = get(handles.txtmonths1,'String'); % Get all the items
Month1 = contents{selectedItem}; % Extract the one item that was selected

Jan
Jan on 17 May 2014
Edited: Jan on 18 May 2014

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!