prtlinesa.m (1813B)
1 function prtlinesa(a1,a2,a3,a4,a5) 2 % PRTLINESa is a front-end to PRINT which converts 3 % solid lines to various line styles for graphical 4 % output. The change is transparent to the user. 5 % Non-solid lines are not affected. 6 % 7 % PRTLINESa is used in the same manner as PRINT. 8 % 9 % The default line styles are: 10 % 11 % '. ' 12 % 'o ' 13 % 'x ' 14 % '+ ' 15 % '- ' 16 % '* ' 17 % ': ' 18 % '-.' 19 % '--' 20 % 21 % The line style can be changed by editing the file 22 % and changing the 'styles' array. 23 % 24 % SEE ALSO: PRINT, Properties of LINE 25 % Written by John L. Galenski III 26 % All Rights Reserved 10/14/93 27 % LDM101493jlg 28 % 29 % PRTLINESa -- the "a" here means "append" instead of create. 1/26/95 30 31 %% PRTLINESa is an M-file developed by me for my own 32 %% personal use, and therefore, it is not supported 33 %% by The MathWorks, Inc., or myself. Please direct 34 %% any questions or comments to johng@mathworks.com. 35 % Create the array of line styles. 36 styles = [ 37 '- ' 38 '--' 39 '. ' 40 ': ' 41 '-.' 42 'o ' 43 'x ' 44 '+ ' 45 '- ' 46 '* ' 47 ]; 48 % Get the Children of the Figure. 49 a = get(gcf,'children'); 50 % Check the Children of 'a'. If they are 51 % solid lines, then change their LineStyle 52 % property. 53 for j = 1:length(a) 54 l = sort(get(a(j),'children')); 55 X = 0; 56 Add = 0; 57 for i = 1:length(l) 58 if strcmp( 'line', get(l(i), 'type' )) 59 if strcmp(get(l(i),'linestyle'),'-') 60 X = X + 1; 61 LINE = [LINE;l(i)]; 62 SI = rem(X,length(styles)); 63 if SI == 0 64 Add = 1; 65 end 66 set(l(i),'linestyle', styles(SI+Add,:)); 67 end 68 end 69 end 70 end 71 % Construct the PRTCMD. 72 PRTCMD = 'print -append'; 73 for x = 1:nargin 74 PRTCMD = [PRTCMD,' ',eval(['a',int2str(x)])]; 75 end 76 77 % Discard the changes so that the Figure is not 78 % updated. 79 drawnow discard 80 eval(PRTCMD) 81 82 83 % RESET THE LINESTYLES 84 set(LINE,'linestyle','-') 85 86 % Discard the changes so that the Figure is not 87 % updated. 88 drawnow discard