ファイル名:YgridAll.m

function ygridall(opt_grid);
% YGRIDALL  Grid lines at all axeses.
%   YGRIDALL ON  adds grid lines to all axes.
%   YGRIDALL OFF  takes them off.
%   YGRIDALL, by itself, toggles the grid state.
%
%   YGRIDALL  sets the YGrid 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,'YGrid'),'off')
       set(ax,'YGrid','on');
   else
       set(ax,'YGrid','off');
   end
elseif strcmp(opt_grid, 'on')
    set(ax,'YGrid', 'on');
elseif strcmp(opt_grid, 'off')
    set(ax,'YGrid', 'off');
else
    error('Unknown command option.');
end