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

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 500
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 458
Synchronized Data Presentations in a Programmatic UI
14-15
% Create a uitable on the left side of the figure
htable = uitable('Units', 'normalized',...
'Position', [0.025 0.03 0.375 0.92],...
'Data', count,...
'ColumnName', colnames,...
'ColumnFormat', colfmt,...
'ColumnWidth', colwdt,...
'ColumnEditable', coledit,...
'ToolTipString',...
'Select cells to highlight them on the plot',...
'CellSelectionCallback',{@select_callback});
The tableplot function performs these tasks:
Passes the count matrix to the table as the Data parameter.
Specifies the column names using the ColumnName property
Specifies that all columns hold numeric data using the ColumnFormat property
Specifies that all columns have a width of 60 pixels
MATLAB always interprets the ColumnWidth property in pixels
Provides a tooltip string for the table
Accepts default values for most of the remaining Uitable Properties.
In the next block of code, the tableplot function sets up an axes on the right side of the
figure. It plots lines and markers in response to the user's actions.
% Create an axes on the right side; set x and y limits to the
% table value extremes, and format labels for the demo data.
haxes = axes('Units', 'normalized',...
'Position', [.465 .065 .50 .85],...
'XLim', [0 tablesize(1)],...
'YLim', [0 max(max(count))],...
'XLimMode', 'manual',...
'YLimMode', 'manual',...
'XTickLabel',...
{'12 AM','5 AM','10 AM','3 PM','8 PM'});
title(haxes, 'Hourly Traffic Counts') % Describe data set
% Prevent axes from clearing when new lines or markers are plotted
hold(haxes, 'all')
In the next block of code, the tableplot function plots the lineseries for the markers
with a call to plot. The plot function graphs the entire count data set (which remains
Zobrazit stránku 458
1 2 ... 454 455 456 457 458 459 460 461 462 463 464 ... 499 500

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

Žádné komentáře