MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manual de usuario Pagina 290

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 330
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 289
12 Examples of GUIs Created Programmatically
12-12
mOutputArgs = {}; % Variable for storing output when GUI returns
mPlotTypes
is a 5-by-2 cell array that holds the data to be plotted in the axes.
The first column contains the strings that are used to populate the pop-up
menu. The second column contains the functions, as anonymous function
handles, that create the plots.
mPlotTypes = {... % Example plot types shown by this GUI
'plot(rand(5))', @(a)plot(a,rand(5));
'plot(sin(1:0.01:25))', @(a)plot(a,sin(1:0.01:25));
'bar(1:.5:10)', @(a)bar(a,1:.5:10);
'plot(membrane)', @(a)plot(a,membrane);
'surf(peaks)', @(a)surf(a,peaks)};
Because the data is created at the top level of the GUI function, it is available
to all callbacks and other functions in the GUI.
See Anonymous Functions in the MATLAB documentation for information
about using anonymous functions.
Creating the GUI and Its Components
Like the data, the components are created at the top level so that their handles
are available to all callbacks and other functions in the GUI.
“The Main Figure” on page 12-12
“The Axes” on page 12-13
“The Pop-Up Menu” on page 12-14
“The Update Push Button” on page 12-14
“The File Menu and Its Menu Items” on page 12-15
“The Toolbar and Its Tools” on page 12-16
The Main Figure
The following statement creates the figure for GUI.
hMainFigure = figure(... % The main GUI figure
'MenuBar','none', ...
'Toolbar','none', ...
'HandleVisibility','callback', ...
'Color', get(0,...
'defaultuicontrolbackgroundcolor'));
Vista de pagina 289
1 2 ... 285 286 287 288 289 290 291 292 293 294 295 ... 329 330

Comentarios a estos manuales

Sin comentarios