MATLAB Answers

1

Why doesn't the position use the specified units in MATLAB R2014b?

Why doesn't the position use the specified units in MATLAB R2014b?

Products


Release

R2014b

1 Answer

Answer by MathWorks Support Team on 7 Oct 2014
 Accepted Answer

Starting in MATLAB R2014b, the order in which you specify position and units matters. If you specify the position and the units in the same function call, then you must specify the units first if you want the position to use those units. If you specify the position first, MATLAB interprets the position in the current units and then converts the values to the new units. 
For example, create a 0.2-by-0.3 inch rectangle. Specify the units before the position so that the position uses the new units. 
annotation('rectangle','Units','inches','Position',[.1 .1 .2 .3])
If you specify the units after the position, then the annotation function interprets the position in normalized units (the default), and then converts the values to inches. 
r = annotation('rectangle','Position',[.1 .1 .2 .3],'Units','inches');
r.Position
ans =
0.5833 0.4375 1.1667 1.3125

  0 Comments

Sign in to comment.