MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 290

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la 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'));
Vedere la pagina 289
1 2 ... 285 286 287 288 289 290 291 292 293 294 295 ... 329 330

Commenti su questo manuale

Nessun commento