www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@toGVCell/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-2013 The MathWorks, Inc. and Ford Global Technologies, Inc.

% Check whether to position object for a Y-axis per cell
obj.DisplayYAxisTickMarks = ~dm.useCommonYAxis;

% Get selection color
if dm.HighLightedColumn==C || dm.HighLightedRow==R
    axesfillcol = [0.784 1.0 0.737];
else
    axesfillcol = get(mbcgui.hgclassesutil.toNative(obj.Parent), 'DefaultAxesColor');
end

if dm.IsBlank(R, C)
    set(obj.hAxes, 'Color','none', ...
        'YTickLabel', {}, ...
        'YTick', [], ...
        'XTick', []);
    set(obj.hModelLine, 'XData', [], 'YData', []);
    set(obj.hErrorLine, 'XData', [], 'YData', []);
    set(obj.hValueLine, 'XData', [], 'YData', []);
    set(obj.hConstraints, 'OpenIntervals', []);
    obj.hConstraints.Visible = 'off';
else
    xlims = dm.getGraphXLimits(R, C);
    set(obj.hAxes, 'Color', axesfillcol, ...
        'XLim', xlims, ...
        'XTickMode', 'auto', ...
        'YTickMode', 'auto');
    set(obj.hModelLine, 'XData', dm.XValues{C}, 'YData', dm.ModelValues{R, C});

    if dm.hasErrorData(R)
        set(obj.hErrorLine, ...
            'XData', [dm.XValues{C} NaN dm.XValues{C}], ...
            'YData', [dm.LowerModelPEBound{R, C}; NaN; dm.UpperModelPEBound{R, C}]);
    else
        set(obj.hErrorLine, 'XData', [], 'YData', []);
    end

    obj.hConstraints.Visible = 'off';

    yl = dm.getGraphYLimits(R, C);
    if ~dm.useCommonYAxis
        % Set y tick mode to auto
        set(obj.hAxes, 'YLim', yl, 'YTickLabelMode', 'Auto');
    else
        set(obj.hAxes, 'YLim', yl, 'YTickLabel', {});
    end


    val = dm.ColumnItemValues(C);
    if val<xlims(1) || val>xlims(2)
        val = NaN;
    end
    set(obj.hValueLine, ...
        'XData', [val val], ...
        'YData', yl);

    if dm.hasConstraintData(R)
        obj.DisplayingConstraints = true;
        set(obj.hConstraints, 'OpenIntervals', dm.ConstraintEdges{R, C}, 'Visible', 'on');
    else
        % Leave object invisible
        obj.DisplayingConstraints = false;
        set(obj.hConstraints, 'OpenIntervals', []);
    end
    
    
end