MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 55

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 54
Laying Out a Simple GUI
3-7
Laying Out a Simple GUI
This topic illustrates the basic steps for laying out a GUI.
“Creating the Figure” on page 3-7
“Adding the Components” on page 3-7
Creating the Figure
In MATLAB, a GUI is a figure. This first step creates the figure and positions
it on the screen. It also makes the GUI invisible so that the GUI user cannot
see the components being added or initialized. When the GUI has all its
components and is initialized, the example makes it visible.
% Initialize and hide the GUI as it is being constructed.
f = figure('Visible','off','Position',[360,500,450,285]);
The call to the figure function uses two property/value pairs. The Position
property is a 4-element vector that specifies the location of the GUI on the
screen and its size: [distance from left, distance from bottom, height, width].
Default units are pixels.
The next topic, “Adding the Components” on page 3-7, shows you how to add
the push buttons, axes, and other components to the GUI
Adding the Components
The example GUI has six components: 3 push buttons, 1 static text, 1 pop-up
menu, and 1 axes. Start by writing statements that add these components to
the GUI. Create the push buttons, static text, and pop-up menu with the
uicontrol function. Use the axes function to create the axes.
1 Add the three push buttons to your GUI by adding these statements to your
M-file following the call to
figure.
% Construct the components.
hsurf = uicontrol('Style','pushbutton',...
'String','Surf','Position',[315,220,70,25]);
hmesh = uicontrol('Style','pushbutton',...
'String','Mesh','Position',[315,180,70,25]);
hcontour = uicontrol('Style','pushbutton',...
'String','Countour','Position',[315,135,70,25]);
Vedere la pagina 54
1 2 ... 50 51 52 53 54 55 56 57 58 59 60 ... 329 330

Commenti su questo manuale

Nessun commento