MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Especificações Página 41

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 216
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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 página 40
1 2 ... 36 37 38 39 40 41 42 43 44 45 46 ... 215 216

Comentários a estes Manuais

Sem comentários