NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/gliderproc/trunk/MATLAB/plots/makehatch.m

Revision 495 (checked in by cbc, 11 years ago)

Initial import of Stark code.

Line 
1 function A = makehatch(hatch)
2 %MAKEHATCH Predefined hatch patterns
3 %  MAKEHATCH(HATCH) returns a matrix with the hatch pattern for HATCH
4 %   according to the following table:
5 %      HATCH        pattern
6 %     -------      ---------
7 %        /          right-slanted lines
8 %        \          left-slanted lines
9 %        |          vertical lines
10 %        -          horizontal lines
11 %        +          crossing vertical and horizontal lines
12 %        x          criss-crossing lines
13 %        .          single dots
14 %
15 %  See also: APPLYHATCH
16
17 %  By Ben Hinkle, bhinkle@mathworks.com
18 %  This code is in the public domain.
19
20 n = 6;
21 A=zeros(n);
22 switch (hatch)
23  case '/'
24   A = fliplr(eye(n));
25  case '\'
26   A = eye(n);
27  case '|'
28   A(:,1) = 1;
29  case '-'
30   A(1,:) = 1;
31  case '+'
32   A(:,1) = 1;
33   A(1,:) = 1;
34  case 'x'
35   A = eye(n) | fliplr(diag(ones(n-1,1),-1));
36  case '.'
37   A(1:2,1:2)=1;
38  otherwise
39   error(['Undefined hatch pattern "' hatch '".']);
40 end
Note: See TracBrowser for help on using the browser.