matlabplotmatlab-figure

How to draw an arrow in Matlab?


I'm trying to draw an arrow in matlab graph, without any success.

Code example:

function [ output_args ] = example( input_args )

figure ('Name', 'example');
x = [10 30]
y = [10 30]
xlim([1, 100])
ylim([1, 100])
arrow (x, y) ???
end

Is there any function in matlab that can draw arrow ? Thanks


Solution

  • You can use the (well-documented) DaVinci Draw toolbox (full disclosure: I wrote/sell the toolbox, though arrows are free). Example syntax and example output are below. [UPDATE: The website that distributed this code is now closed. See note in comments.]

    davinci( 'arrow', 'X', [0 10], 'Y', [0 2], <plus-lots-of-options> )
    

    enter image description here