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

조회 수: 1 (최근 30일)
Shyam
Shyam 2013년 4월 12일
I want to rephrase my earlier question as follows:
How can a GUI pop up menu be made to show the last selected option?

답변 (2개)

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

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


Yao Li
Yao Li 2013년 4월 12일
allItems = get(handles.popupmenu1, 'string')
set(handles.popupmenu1,'String',allItems);
  댓글 수: 13
Shyam
Shyam 2013년 4월 12일
but if u close matlab then the value u stored using setappdata is lost.... how to retain the value?
Image Analyst
Image Analyst 2013년 4월 12일
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.

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

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by