Works nicely, but i did find a bug:
an exactly vertical arrow (from [0 0 0] to [0 0 1]) is plotted with a length of ~16 reaching far in the negative z-domain. Just type in
arrow([0 0 0],[0 0 1])
and see.
Does someone know a solution to this?
with kind regards,
Johan.
@Li, after reading Rajib's comment below, I saw you can change color in one function call:
h = arrow(..., 'EdgeColor', 'g', 'FaceColor', 'g');
@Tobias, I don't have 2014b, but you could try replacing line 423 with:
ax = repmat(o, narrows, 1);
After updating Matlab to 2014b, arrow.m is not working. It is stopping in line 423 with the error:
Undefined function 'mtimes' for input arguments of type 'matlab.graphics.axis.Axes'.
Error in arrow (line 423)
ax = o * gca;
Can somebody please help me?
Terrific. Thanks.
For those of you who would like to have a small gap between the arrow and the start and end point (e.g. so as not to obscure a marker), I've written a slight update (note: not compatible with arrow.m properties directly, but you could easily adapt):
function [varargout] = my_arrow(start,stop)
arrow_gap_pc = 0.05; % defines gap size relative to size of initial arrow
d=stop-start;
dx=d(1);dy=d(2);dz=d(3);
[th,phi,r] = cart2sph(dx,dy,dz);
arrow_gap = arrow_gap_pc*r;
[x1,y1,z1] = sph2cart(th,phi,arrow_gap);
b = start+[x1 y1 z1];
e = stop-[x1 y1 z1];
ah = arrow(b,e);
if nargout == 1
varargout{1} = ah; end
Comment only