ファイル名:GridAll.m
function gridall(opt_grid);
% GRIDALL Grid lines at all axeses.
% GRIDALL ON adds grid lines to the current axes.
% GRIDALL OFF takes them off.
% GRIDALL, by itself, toggles the grid state.
%
% GRIDALL sets the XGrid, YGrid, and ZGrid 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)
for k = 1:length(ax)
if (strcmp(get(ax(k),'XGrid'),'off'))
set(ax(k),'XGrid','on');
else
set(ax(k),'XGrid','off');
end
if (strcmp(get(ax(k),'YGrid'),'off'))
set(ax(k),'YGrid','on');
else
set(ax(k),'YGrid','off');
end
if (strcmp(get(ax(k),'ZGrid'),'off'))
set(ax(k),'ZGrid','on');
else
set(ax(k),'ZGrid','off');
end
end
elseif (strcmp(opt_grid, 'on'))
set(ax,'XGrid', 'on');
set(ax,'YGrid', 'on');
set(ax,'ZGrid', 'on');
elseif (strcmp(opt_grid, 'off'))
set(ax,'XGrid', 'off');
set(ax,'YGrid', 'off');
set(ax,'ZGrid', 'off');
else
error('Unknown command option.');
end