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

1 view (last 30 days)

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 7 Oct 2014
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

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products


Release

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!