www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtradeoffgui/@mmeditor/pAutoGenerateGrid.m

    function pAutoGenerateGrid(obj)
%PAUTOGENERATEGRID Update the grid breakpoints to be the optimal set
%
%  PAUTOGENERATEGRID(OBJ) changes the Breakpoints property to be the
%  optimal set of breakpoints as provided by the sample switch model.

%  Copyright 2000-2008 The MathWorks, Inc. and Ford Global Technologies, Inc.


if ~isempty(obj.SampleTakenModel)
    bp = getOptimalGrid(obj.SampleTakenModel);
    
    % Check whether any grid dimensions have reduced to a single point.
    % These are unsuitable for normalisers so we'll duplicate the point
    % make it valid.
    bp = cellfun(@iCheckLength, bp, 'UniformOutput', false);
    
    obj.Breakpoints = bp;
else
    obj.Breakpoints = {};
end


function bp = iCheckLength(bp)
if isscalar(bp)
    bp = [bp; bp];
end