MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 60

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 500
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 59
3 A Simple Programmatic UI
3-8
end
function contourbutton_Callback(source,eventdata)
% Display contour plot of the currently selected data.
contour(current_data);
end
Program the Callbacks
When the user selects a data set from the pop-up menu or clicks one of the push buttons,
MATLAB software executes the callback associated with that particular event. Use each
component's Callback property to specify the name of the callback with which each
event is associated.
1
To the uicontrol statement that defines the Surf push button, add the property/
value pair
'Callback',{@surfbutton_Callback}
so that the statement looks like this:
hsurf = uicontrol('Style','pushbutton','String','Surf',...
'Position',[315,220,70,25],...
'Callback',{@surfbutton_Callback});
Callback is the name of the property. surfbutton_Callback is the name of the
callback that services the Surf push button.
2
To the uicontrol statement that defines the Mesh push button, add the property/
value pair
'Callback',@meshbutton_Callback
3
To the uicontrol statement that defines the Contour push button, add the
property/value pair
'Callback',@contourbutton_Callback
4
To the uicontrol statement that defines the pop-up menu, add the property/value
pair
'Callback',@popup_menu_Callback
For more information, see “Write Callbacks Using the Programmatic Workflow” on page
11-5.
Vedere la pagina 59
1 2 ... 55 56 57 58 59 60 61 62 63 64 65 ... 499 500

Commenti su questo manuale

Nessun commento