문제

I've made a popup-menu in Matlab using uicontrol, instead of using GUIDE. Here is my code:

figure; 
String = sprintf( '%d#', 1:5);
String(end) = [];
CString=regexp(String , '#' , 'split');
uicontrol('style','popupmenu' , ...
          'String' , CString  , ...
          'Position' , [100,400,100,24]);

But I don't know how can I put a subject for the popup-menu.

If anyone knows I'll appreciate for your help.

Thank You in Advance

도움이 되었습니까?

해결책

You need to add another ui object, probably text or edit beside the popup menu:

(I personally rather edit since it looks nicer)

txt_obj = uicontrol(...
    'Style','edit',...
    'HorizontalAlignment','right',...
    'String', 'Something',...
    'Position' , [0,400,100,24],...
    'BackgroundColor', [.9 .9 .9],...
    'Enable','inactive');

I encourage you to use normalized units for ease of coding (positioning actually!). For more info see position property if uicontrol object and Positioning Figures (which has the same concept of positioning).

다른 팁

First, set a figure handle:

h = figure;

Then, set the name of the window:

set(h,'Name','This is my title text');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top