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