www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@toGVRowHeader/setTableData.m
function setTableData(obj, R, C, dm) %SETTABLEDATA Scrolling table interface function % % SETTABLEDATA(OBJ, R, C, DATA) sets up OBJ to display the information % from row R and column C of the data object DATA. % Copyright 2000-2015 The MathWorks, Inc. and Ford Global Technologies, Inc. % Check whether we are showing the correct display - axis or no axis? obj.ShowAxis = dm.useCommonYAxis; % Check whether to use wider headers or not obj.WideHeaderMode = dm.WideHeaders; % Construct label string to include the current output value if obj.WideHeaderMode labelstr = dm.RowItemLabels{R}; if isnan(dm.RowItemValues(R)) valuestr = 'No value'; else valuestr = sprintf('Value:\n%g', dm.RowItemValues(R)); end else if isnan(dm.RowItemValues(R)) labelstr = sprintf('%s: %s', dm.RowItemLabels{R}, 'No value'); else labelstr = sprintf('%s: %g', dm.RowItemLabels{R}, dm.RowItemValues(R)); end end if obj.ShowAxis graphlims = dm.getGraphYLimits(R, C); axisval = dm.RowItemValues(R); if axisval<graphlims(1) || axisval>graphlims(2) axisval = NaN; end set(obj.hSharedAxis, 'String', labelstr, ... 'Value', axisval, ... 'Selected', dm.SelectedRow==R); obj.hSharedAxis.setLimits(graphlims(1), graphlims(2)); if obj.WideHeaderMode if dm.SelectedRow==R fontw = 'bold'; else fontw = 'normal'; end set(obj.hValueLabel, 'String', valuestr, 'FontWeight', fontw, 'Tag', [dm.RowItemLabels{R}, 'Label']); end else if dm.SelectedRow==R fontw = 'bold'; else fontw = 'normal'; end set(obj.hLabel, 'String', labelstr, 'FontWeight', fontw); if obj.WideHeaderMode set(obj.hValueLabel, 'String', valuestr, 'FontWeight', fontw, 'Tag', [dm.RowItemLabels{R}, 'Label']); end end % Check whether to highlight the row header as the current fill item SC = xregGui.SystemColorsDbl; if dm.HighLightedRow==R selectedColor = [0.784 1.0 0.737]; set(obj.hBorder, 'BackgroundColor', selectedColor); set(obj.hValueLabel, 'BackgroundColor', selectedColor); else set(obj.hBorder, 'BackgroundColor', SC.CTRL_BG); set(obj.hValueLabel, 'BackgroundColor', SC.CTRL_BG); end