prtlines.m (1729B)
1 function prtlines(a1,a2,a3,a4,a5) 2 % PRTLINES 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 % PRTLINES 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 %% PRTLINES is an M-file developed by me for my own 30 %% personal use, and therefore, it is not supported 31 %% by The MathWorks, Inc., or myself. Please direct 32 %% any questions or comments to johng@mathworks.com. 33 % Create the array of line styles. 34 styles = [ 35 '- ' 36 '--' 37 '-.' 38 ': ' 39 '. ' 40 'o ' 41 'x ' 42 '+ ' 43 '- ' 44 '* ' 45 ]; 46 % Get the Children of the Figure. 47 a = get(gcf,'children'); 48 % Check the Children of 'a'. If they are 49 % solid lines, then change their LineStyle 50 % property. 51 for j = 1:length(a) 52 l = sort(get(a(j),'children')); 53 X = 0; 54 Add = 0; 55 for i = 1:length(l) 56 if strcmp( 'line', get(l(i), 'type' )) 57 if strcmp(get(l(i),'linestyle'),'-') 58 X = X + 1; 59 LINE = [LINE;l(i)]; 60 SI = rem(X,length(styles)); 61 if SI == 0 62 Add = 1; 63 end 64 set(l(i),'linestyle', styles(SI+Add,:)); 65 end 66 end 67 end 68 end 69 % Construct the PRTCMD. 70 PRTCMD = 'print'; 71 for x = 1:nargin 72 PRTCMD = [PRTCMD,' ',eval(['a',int2str(x)])]; 73 end 74 75 % Discard the changes so that the Figure is not 76 % updated. 77 drawnow discard 78 eval(PRTCMD) 79 80 81 % RESET THE LINESTYLES 82 set(LINE,'linestyle','-') 83 84 % Discard the changes so that the Figure is not 85 % updated. 86 drawnow discard