addrefarrow

PURPOSE ^

addrefarrow(h,x,y,u,v)

SYNOPSIS ^

function addrefarrow(h,x,y,u,v)

DESCRIPTION ^

 addrefarrow(h,x,y,u,v)

 This is a quick hack to add a scale/reference arrow at a desired position
 given by  the input argument (x,y).  The scale arrow length in the x
 direction is given by u, in the y direction by v.  

 The input handle h is created by the quiver command
 h = quiver(.....

 WARNING, this function modifies the data contained in the quiver graphics
 group handle h!

 R. Moucha, GEOTOP-UQAM-MCGILL
 March 29, 2007

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function addrefarrow(h,x,y,u,v)
0002 
0003 % addrefarrow(h,x,y,u,v)
0004 %
0005 % This is a quick hack to add a scale/reference arrow at a desired position
0006 % given by  the input argument (x,y).  The scale arrow length in the x
0007 % direction is given by u, in the y direction by v.
0008 %
0009 % The input handle h is created by the quiver command
0010 % h = quiver(.....
0011 %
0012 % WARNING, this function modifies the data contained in the quiver graphics
0013 % group handle h!
0014 %
0015 % R. Moucha, GEOTOP-UQAM-MCGILL
0016 % March 29, 2007
0017 
0018 % Retrieve 2D data from quiver group
0019 
0020 X = get(h,'Xdata');
0021 Y = get(h,'Ydata');
0022 U = get(h,'Udata');
0023 V = get(h,'Vdata');
0024 
0025 % Since we are adding a single arrow, we
0026 % must use vectors and not grid matrices.
0027 X = X(:);
0028 Y = Y(:);
0029 U = U(:);
0030 V = V(:);
0031 
0032 % Add scale arrow position and lengths
0033 X(end+1) = x;
0034 Y(end+1) = y;
0035 U(end+1) = u;
0036 V(end+1) = v;
0037 
0038 % Update the arrows
0039 set(h,'Xdata',X,'Ydata',Y,'Udata',U,'Vdata',V)

Generated on Thu 21-Aug-2014 10:40:31 by m2html © 2005