MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 56

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 55
3 Creating a GUI Programmatically
3-8
These statements use the uicontrol function to create the push buttons.
Each statement uses a series of property/value pairs to define a push button.
Each call returns the handle of the component that is created.
2 Add the pop-up menu and its label to your GUI by adding these statements
to the M-file following the push button definitions.
hpopup = uicontrol('Style','popupmenu',...
'String',{'Peaks','Membrane','Sinc'},...
'Position',[300,50,100,25]);
htext = uicontrol('Style','text','String','Select Data',...
'Position',[325,90,60,15]);
For the pop-up menu, the String property uses a cell array to specify the
three items in the pop-up menu:
Peaks, Membrane, Sinc. The static text
component serves as a label for the pop-up menu. Its
String property tells
the GUI user to
Select Data. Default units for these components are pixels.
3 Add the axes to the GUI by adding this statement to the M-file. Set the
Units property to pixels so that it has the same units as the other
components.
ha = axes('Units','pixels','Position',[50,60,200,185]);
4 Align all components except the axes along their centers with the following
statement. Add it to the M-file following all the component definitions.
align([hsurf,hmesh,hcontour,htext,hpopup],'Center','None');
Property Description
Style
In the example, pushbutton specifies the component as a
push button.
String
Specifies the label that appears on each push button.
Here, there are three types of plots:
Surf, Mesh, Contour.
Position
Uses a 4-element vector to specify the location of each
push button within the GUI and its size: [distance from
left, distance from bottom, height, width]. Default units
for push buttons are pixels.
Vedere la pagina 55
1 2 ... 51 52 53 54 55 56 57 58 59 60 61 ... 329 330

Commenti su questo manuale

Nessun commento