MATLAB Answers

Specifying attributes of objects created in GUIDE

1 view (last 30 days)
Kim on 24 Apr 2019
Commented: Kim on 24 Apr 2019
I'm creating a UI using GUIDE. It is important that I position items in the UI in exact locations. I can only approximately position objects using the mouse to move the objects around. Is there a command line method to specify - for instance - exact coordinates of a button's position i.e., [1.0, 1.0, 2.0, 1.5]?


Sign in to comment.

Accepted Answer

Dennis on 24 Apr 2019
If you want to do this in guide you can get there in 3 steps:
1.) right click on your object
2.) chose 'Property Inspector'
3.) go to 'Location and Size' (Group Properties) or 'Position (List Properties)


Kim on 24 Apr 2019
That was the first thing I tried, but the location and position fields aren't editable in the Property Inspector.
Kim on 24 Apr 2019
Wooops, I'm a little slow. I didn't notice that 'Position' can be opened, then you can edit x, y, width, and height.

Sign in to comment.

More Answers (1)

Alex Mcaulley
Alex Mcaulley on 24 Apr 2019
Edited: Alex Mcaulley on 24 Apr 2019
set(handles.yourButton,'Units', 'pixels') %If your position is in pixels
set(handles.yourButton,'Position', [1.0, 1.0, 2.0, 1.5])

  1 Comment

Kim on 24 Apr 2019
yeah, except set and get don't seem to work when you're doing GLIDE.

Sign in to comment.

Sign in to answer this question.




Translated by