www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@scrollTable/pGetDataSize.m

    function sz = pGetDataSize(obj, dim)
%PGETDATASIZE Get the size of the data array.
%
%   SZ = PGETDATASIZE(OBJ) returns the number of rows and columns in the
%   data model.
%
%   SZ = PGETDATASIZE(OBJ, DIM) returns the length of the specified
%   dimension (DIM=1 => number of rows, DIM=2 => number of columns).

%   Copyright 2006 The MathWorks, Inc.


if nargin==1
    if obj.pDataIsArray
        sz = size(obj.MainData);
    else
        sz = [obj.MainData.getRowCount, obj.MainData.getColumnCount];
    end
else
    if obj.pDataIsArray
        sz = size(obj.MainData, dim);
    else
        if dim==1
            sz = obj.MainData.getRowCount;
        elseif dim==2
            sz =obj.MainData.getColumnCount;
        else
            sz = 1;
        end
    end
end