www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcfoundation/@gridDefinition/getSubPositions.m

    function el_pos = getSubPositions(obj, Rindex, Cindex, pos)
%GETSUBPOSITIONS Get cell array of grid positions for sub-area of grid
%
%  GRID_POS = GETSUBPOSITIONS(OBJ, ROWINDEX, COLINDEX, POS) creates a
%  vector of positions for the cells in sub-area of the grid defined by the
%  index vectors ROWINDEX and COLINDEX.

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


if isempty(obj.RowRatios)
    RR = ones(1, obj.Rows)./obj.Rows;
else
    RR = obj.RowRatios(Rindex);
end
if isempty(obj.ColumnRatios)
    CR = ones(1, obj.Columns)./obj.Columns;
else
    CR = obj.ColumnRatios(Cindex);
end

if obj.DoMerge
    MRow = obj.MergeNRows(Rindex, Cindex);
    MCol = obj.MergeNCols(Rindex, Cindex);
else
    MRow = [];
    MCol = [];
end
el_pos = obj.pCalcPositions(pos, ...
    length(Rindex), ...
    length(Cindex), ...
    obj.RowSizes(Rindex), ...
    obj.ColumnSizes(Cindex), ...
    RR, ...
    CR, ...
    obj.RowGap, ...
    obj.ColumnGap, ...
    obj.DoMerge, ...
    MRow, ...
    MCol);