ファイル名:XgridAll.m

function xgridall(opt_grid);
% XGRIDALL  Grid lines at all axeses.
%   XGRIDALL ON  adds grid lines to all axes.
%   XGRIDALL OFF  takes them off.
%   XGRIDALL, by itself, toggles the grid state.
%
%   XGRIDALL  sets the XGrid properties of the all axeses in the current figure.
%
%   See also TITLE, XLABEL, YLABEL, ZLABEL, AXES, PLOT.

%   Copyright (c) 1984-97 by The MathWorks, Inc.
%   $Revision: 5.3 $  $Date: 1997/04/08 06:08:16 $
ax = findobj(gcf,'Type','axes');
% ax = gca;
if nargin == 0
   if strcmp(get(ax,'XGrid'),'off')
       set(ax,'XGrid','on');
   else
       set(ax,'XGrid','off');
   end
elseif strcmp(opt_grid, 'on')
    set(ax,'XGrid', 'on');
elseif strcmp(opt_grid, 'off')
    set(ax,'XGrid', 'off');
else
    error('Unknown command option.');
end