function s = getGridSize(this,dim)
%GETGRIDSIZE  Returns grid size or grid dimension length.

%   Copyright 1986-2003 The MathWorks, Inc.
%   $Revision: 1.1.6.1 $  $Date: 2004/12/26 21:31:22 $

if isempty(this.Grid_)
   s = [0 0];
else
   s = [this.Grid_.Length];
end
s = [s ones(1,2-length(s))];

if nargin>1
   if dim>length(s)
      s = 1;
   else
      s = s(dim);
   end
end