MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelský manuál Strana 43

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 330
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 42
Programming the GUI
2-23
It then uses a switch statement to make the selected data set the current
data. The last statement saves the changes to the
handles structure.
% Determine the selected data set.
str = get(hObject, 'String');
val = get(hObject,'Value');
% Set current data to the selected data set.
switch str{val};
case 'Peaks' % User selects peaks
handles.current_data = handles.peaks;
case 'Membrane' % User selects membrane
handles.current_data = handles.membrane;
case 'Sinc' % User selects sinc
handles.current_data = handles.sinc;
end
% Save the handles structure.
guidata(hObject,handles)
Programming the Push Buttons
Each of the 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 get
data from the
handles structure and then plot it.
1 Display the Surf push button callback in the M-file editor. Right click the
Surf pushbutton in the Layout Editor to display a context menu. From that
menu select
View Callbacks -> Callback.
Zobrazit stránku 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 329 330

Komentáře k této Příručce

Žádné komentáře