How can a GUI pop up menu be made to show the previous selected option?

1 Ansicht (letzte 30 Tage)
Shyam
Shyam am 12 Apr. 2013
I want to rephrase my earlier question as follows:
How can a GUI pop up menu be made to show the last selected option?

Antworten (2)

Image Analyst
Image Analyst am 12 Apr. 2013
This would probably work, though I haven't tested it.
allItems = get(handles.popup, 'string');
numberOfItems = length(allItems);
set(handles.popup, 'value', numberOfItems);
  10 Kommentare
Image Analyst
Image Analyst am 12 Apr. 2013
If that will acceptable, then please mark the answer as "Accepted" to close this out. Thanks.

Melden Sie sich an, um zu kommentieren.


Yao Li
Yao Li am 12 Apr. 2013
allItems = get(handles.popupmenu1, 'string')
set(handles.popupmenu1,'String',allItems);
  13 Kommentare
Shyam
Shyam am 12 Apr. 2013
but if u close matlab then the value u stored using setappdata is lost.... how to retain the value?
Image Analyst
Image Analyst am 12 Apr. 2013
Obviously. If you want to save the value to a disk file, you can do that with save() or fprintf(), or even xlswrite() or dlmwrite.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by