Spacey
Spacey

Reputation: 3011

Make MATLAB panels automatically rescale. (Not using GUIDE)

I have created a basic MATLAB UI (without using GUIDE). I basically have a bunch of panels for various things, (sliders, axes, text boxes, etc).

The one thing I would like to do though, it make it so that they scale properly, when I resize the figure. Right now, I painstakingly have to make a re-scale function for every button, panel, sub-panel, etc etc to make it rescale correctly.

Is there an easy way to simply automate the re-scaling here?

Thanks.

Upvotes: 0

Views: 382

Answers (2)

sebastian
sebastian

Reputation: 9696

You could also use the builtin, but undocumented uigridcontainer and uiflowcontainer.

They have the benefit of e.g. allowing to set contraints, such that e.g. your pushbuttons don't get increased in size, when the full figure does. Check the link for some examples: http://undocumentedmatlab.com/blog/matlab-layout-managers-uicontainer-and-relatives/

Upvotes: 2

Dang Khoa
Dang Khoa

Reputation: 5823

Use the GUI Layout Toolbox from the MATLAB File Exchange. I haven't personally used dynamic resizing functionality, but that's one benefit of using this package.

It functions much like using uicontrols, except you can't use the inspect tool on these objects.

EDIT: If you're looking only to do resizing when the figure itself is resized, set the Units property for all your uicontrols to normalized.

Upvotes: 3

Related Questions