Popup Menu problem in accessing the string

2 ビュー (過去 30 日間)
Imran Babar
Imran Babar 2013 年 6 月 13 日
I am using a popup menu that is populated with numbers 0-3 but when I access the numbers it returns the value instead of the string. Any one can help me in this regard.
Imran
  1 件のコメント
Jan
Jan 2013 年 6 月 13 日
編集済み: Jan 2013 年 6 月 13 日
It would be helpful if you post your code. Then it would be much easier to suggest the required changes. What exactly "returns the value"?

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2013 年 6 月 13 日
編集済み: Jan 2013 年 6 月 13 日
I guess some details, perhaps it helps:
Value = get(popupMenuHandle, 'Value');
String = get(popupMenuHandle, 'String');
Selected = String{Value};
  1 件のコメント
Imran Babar
Imran Babar 2013 年 6 月 13 日
I am using the same code with callback function of popupmenu I want to use the strings for addition but each time the value or index of popupmenu is added. I am using 8 popupmenus and when I select the values it gives the result 8 in stead of the actual results. I think so sir I am wrong in making handles. Can you guide me that is there need of
guidata(hObject, handles) and how I will use it with the above mentioned code.
previously I have tried this code with the callback function of push button
parameter1=get(handles.popupmenu1,'Value') -1;
surely it will return the value of the popupmenu. But I have used the same code in Matlab7 and it is working fine but it is creating problem with matlab R2012a and R2012b

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSimulink Environment Customization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by