MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Guía de usuario Pagina 80

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 759
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 79
3 How to Create a Simple GUI Programmatically
end
The next topic, “Program the Push Buttons” on page 3-12, shows you how to
write callbacks for the three push buttons.
Program the Push Buttons
Each of the three push buttons creates a different type of plot using the
data specified by the current selection in the pop-up menu. The push button
callbacks plot the data in
current_data. They automatically have access to
current_data because they are nested at a lower level.
Add the following callback s to your file following t he pop-up m en u callback
and before the final
end statement.
% Push button callbacks. Each callback plots curr ent_data in the
% specified plot type.
function sur fbut ton_Callback(source,eve ntdata)
% Display surf plot of the currently selec ted data.
surf(current_data);
end
function mes hbut ton_Callback(source,eve ntdata)
% Display mesh plot of the currently selec ted data.
mesh(current_data);
end
function con tour button_Callback(source, eventdata)
% Display contour plot of the currently se lected data.
contour(current_data);
end
The next topic shows you how to associate each callback with its specific
component.
Program Callbacks for the Simple GUI Components
When the GUI user selects a data set from the pop-up menu or clicks one o f
the push buttons, MATLAB software executes the callback associated with
3-12
Vista de pagina 79
1 2 ... 75 76 77 78 79 80 81 82 83 84 85 ... 758 759

Comentarios a estos manuales

Sin comentarios