MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Especificaciones Pagina 41

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 216
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 40
Programming the GUI
2-19
Sharing Data Between Callbacks
This topic describes the process for sharing data between callbacks in a GUI.
Subsequent topics, “Adding Code to the Opening Function” on page 2-20 and
“Adding Code to the Callbacks” on page 2-22, contain examples.
You can share data between callbacks by storing the data in the MATLAB
handles structure. All components in a GUI share the same handles structure.
It is passed as an input argument to all callbacks generated by GUIDE.
For example, to store data contained in vector
X in the handles structure, you
1 Choose a name for the field of the handles structure where you want to store
the data, for example,
handles.my_data
2 Add the field to the handles structure and set it equal to X with the following
statement:
handles.my_data = X;
3 Save the handles structure with the guidata function:
guidata(hObject,handles)
Here, hObject is the handle to the component object that executes the callback.
The component’s object handle is passed as the input argument,
hObject, to
each of its callbacks that is generated by GUIDE.
Vista de pagina 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 215 216

Comentarios a estos manuales

Sin comentarios