www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/+mbcgui/+widget/@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-2015 The MathWorks, Inc.


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