MATLAB: How to calculate the width and height of the title box of a panel in App Designer

appdesignerdimensionsheightMATLABpanelwidth

When creating a panel in App Designer, there is a box around the title text of the panel. How can I calculate the dimensions of this box?

Best Answer

Refer to the code below for an example for how to calculate the dimensions of a panel's title box:
>> drawnow
>> width = app.ExamplePanel.Position(3);
>> height = app.ExamplePanel.Position(4) - app.ExamplePanel.InnerPosition(4);
Be aware that the view must be updated with a call to 'drawnow' prior to accessing a panel's 'InnerPosition' property. Otherwise, the value of 'InnerPosition' may be incorrect.