MATLAB: How to maintain aspect ratio of the GUI

aspect ratioguiresize

Hello,
I have made a GUI and designed it to fit well in the entire screen space of my workstation, but if I run the file on my laptop, it doesn't resize or maintain aspect ratio ergo rendering some parts of the GUI inaccessible. How do I make the changes??? Please help…
Thank you in advance…

Best Answer

You would be able to use this to enforce proportions. Fetch the current figure height and width and use your target aspect ratio to compute the ideal width. If the actual width is larger than the ideal width then make the window narrower leaving the height alone; if the actual width is smaller than the ideal width then make the window shorter leaving the width alone.
Everything else would be set to be positioned proportional to the figure.