How to get the data from a popup menu and display the selected data in list box?
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm having the problem that, I got one popup menu with three data and a list box. A push button which transfers the selected data from the popup menu to the list box. This is the concept. But I have the problem that, when I select one dat6a from the popup menu all the data appears instead the selected.
Is there any possibility that, the string what I selected from the popup menu can be displayed as a label for a figure?
댓글 수: 0
채택된 답변
Matt Fig
2012년 8월 17일
편집: Matt Fig
2012년 8월 17일
function [] = GUI_pop_to_list()
S.fh = figure('units','pixels',...
'position',[450 450 400 150],...
'menubar','none',...
'resize','off',...
'numbertitle','off',...
'name','GUI_pop_to_list');
S.pp = uicontrol('style','pop',...
'units','pix',...
'position',[10 60 190 40],...
'string',{'Data 1';'Data 2';'Data3'},...
'fontweight','bold',...
'horizontalalign','center',...
'fontsize',11);
S.ls = uicontrol('style','list',...
'units','pix',...
'position',[210 70 190 60],...
'backgroundcolor','w',...
'HorizontalAlign','left');
S.pb = uicontrol('style','push',...
'units','pix',...
'position',[10 10 380 40],...
'HorizontalAlign','left',...
'string','Transfer',...
'fontsize',14,'fontweight','bold',...
'callback',{@pb_call,S});
uicontrol(S.pp) % Give the editbox control.
function [] = pb_call(varargin)
% Callback for edit.
S = varargin{3};
E = get(S.pp,{'string','value'});
STR = get(S.ls,'string');
set(S.ls,'string',[STR;E{1}(E{2})])
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!