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

1 次查看(过去 30 天)

采纳的回答

MathWorks Support Team
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 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

产品


版本

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by