% Use "normalized" for X and Width. % Use "pixels" for Y and Height. setpos(h,'0.25nz 100px 0.5nz 300px');There are other nice features, such as incrementing by certain values:
% Increase the width by 200 pixels setpos(h,'# # +200px #');Or positioning objects relative to other objects:
setpos(figure, '# # 400px 300px'); u(1) = uicontrol('string', '(0,0) gcf'); setpos(u(1), '0 0 60px 40px') u(2) = uicontrol('string', '(0,0) gca'); setpos(u(2), '0 0 60px 40px', gca)This function will allow me to do precise positioning of UIs with fewer lines of code. Thanks Jerome! Next week, I will introduce a different tool that assists in the overal GUI design. Stay tuned for Part 3... Comments? Tell us what you think about when you are laying out your GUI components. Is it readability? Or is it the level of informational content? Written by Jiro Doke, Senior Applications Engineer, The MathWorks, Inc.
댓글을 남기려면 링크 를 클릭하여 MathWorks 계정에 로그인하거나 계정을 새로 만드십시오.