MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelská příručka Strana 691

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 759
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 690
GUI that Displays and Graphs Tabular Data
% Callback to erase and replot markers, showing only those
% corresponding to user-selected cells in table.
% Repeatedly called while user drags across c ells of the uitable
% hmkrs are handles to lines having markers only
set(hmkrs, 'Vi sibl e', 'off') % turn them off to begin
% Get the list of currently selected table c ells
sel = eventdata.Indices; % Get selection indice s (row, col)
% Noncontiguous selections are ok
selcols = unique(sel(:,2)); % Get all selected data col IDs
table = get(hObject,'Data'); % Get copy of u itab le data
% Get vectors of x,y values for each column in the selectio n;
for idx = 1:numel(selcols)
col = selcols(idx);
xvals = sel(:,1);
xvals(sel(:,2) ~= col) = [];
yvals = table(xvals, col)';
% Create Z-vals = 1 in o rder to plot marker s above lines
zvals = col*ones(size(xvals));
% Plot markers for xvals and yvals using a line object
set(hmkrs(col), 'Visible', 'on',...
'XData', xvals ,.. .
'YData', yvals ,.. .
'ZData', zvals )
end
end
To view the se lect _callback code in the Editor, click h ere.
The rows and columns of the selected cells are passed in
eventdata.Indices
and copied into sel. For example, if all three columns in row three of the
table are selected,
eventdata =
Indices: [3x2 double]
sel =
31
15-27
Zobrazit stránku 690
1 2 ... 686 687 688 689 690 691 692 693 694 695 696 ... 758 759

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

Žádné komentáře