function cyclelines

% A shamelessly hacked version of PRTLINES by John L. Galenski III
%
% CYCLELINES converts solid lines to various line styles for graphical
% output.  The change is transparent to the user. Non-solid lines are not
% affected.

% Create the array of line styles.
styles = [
'- '
'--'
'-.'
': '
];

% Get the Children of the Figure.
a = get(gcf,'children');
% Check the Children of 'a'.  If they are
% solid lines, then change their LineStyle
% property.
for j = 1:length(a)
  l = sort(get(a(j),'children'));
  X = 0;
  SI = 0;
  Add = 0;
  for i = 1:length(l)
    if strcmp( 'line', get(l(i), 'type' ))
      if strcmp(get(l(i),'linestyle'),'-')
	X = X + 1;
	LINE = [LINE;l(i)];
	SI =  SI+1;
	if SI == length(styles)+1;
	  SI = 1;
	end
	set(l(i),'linestyle', styles(SI,:));
      end
    end
  end
end
