Pregunta

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

¿Fue útil?

Solución

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).

Otros consejos

First, set a figure handle:

h = figure;

Then, set the name of the window:

set(h,'Name','This is my title text');
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top