Source code used to draw grid of 11 example arrows for "arrow" documentation

% Draw 11 example arrows.

ST = { []  []  []; ...    % Shaft.Type.
       []  []  []; ...
       []  []  []; ...
       'l' []  [] };

SW = { [] []  1; ...      % Shaft.Width.
        3  1 []; ...
        5  5  5; ...
       [] [] [] };  

HL = {  5 [] []; ...      % Head.Length.
       [] []  2; ...
        3  4 10; ...
       10 10 10 };  

HS = { []  3 []; ...      % Head.Sweep.
        3  1  0; ...
       [] [] []; ...
        2  2 [] };

HW = { [] [] []; ...      % Head.Width.
       []  2  3; ...
        3  5  5; ...
        4  4 [] };

ID = { 'A' 'B' 'C'; ...   % Label.
       'D' 'E' 'F'; ...
       'G' 'H' 'I'; ...
       'J' '*' 'K' };     % '*' means "do not draw"

for j = 1: 4   % 4 rows.

    % Compute the y-coordinate.
    this_y = -(j-1) * 10;

    for i = 1: 3    % 3 columns.

        % Compute the x-coordinate.
        this_x = (i-1)*20;

        % Assemble the parameter/value pairs to send to davinci().
        args = {};
        if  isempty( ST{j,i} ); args = [ args 'Shaft.Type' 'rectangle' ]; end
        if ~isempty( SW{j,i} ); args = [ args 'Shaft.Width' SW{j,i} ]; end
        if ~isempty( HL{j,i} ); args = [ args 'Head.Length' HL{j,i} ]; end
        if ~isempty( HS{j,i} ); args = [ args 'Head.Sweep'  HS{j,i} ]; end
        if ~isempty( HW{j,i} ); args = [ args 'Head.Width'  HW{j,i} ]; end

        % Draw the arrow unless "*" indicates not to.
        if ~strcmp( ID{j,i}, '*' )
            davinci( 'arrow', 'X', [this_x this_x+10], 'Y', [this_y this_y], ...
                              args{:} );
            text( this_x+12, this_y+1, ID{j,i}, 'FontSize', 16 );
        end

        % After drawing the first arrow, set "hold on" and fix the
        % aspect ratio at 1:1.
        if i==1 && j==1
            hold on
            daspect([1 1 1])
        end

    end

end

hold off