Text 'Extent' property doesn't contain the correct size
问题 I want to place some text in a GUI, and I want to know the exact size the uicontrol of type 'text' needs to be! I've found several threads explaining that this can be done using the 'Extent' property of a 'text' object containing the same text, see example: function form = tempfunc(txt,font,fontsize) if nargin <3 fontsize = 10; end if nargin < 2 font = 'courier'; end f = figure('Visible','off','Units','pixels'); u = uicontrol(f,'Style','text','Units','pixels','String',txt,'FontName',font,