MATLAB Answers

How can I fix the position of a figure (non movable figure)?

31 views (last 30 days)
Roratonga on 25 Oct 2016
Edited: Marko Hecht on 18 Jan 2019
I want a figure as overlay to another software. I managed to set the figure always on top and not resizable. In addition I now need to fix the position of the figure on the screen. (I want to avoid a loop which always checks the position and sets it to its original position.)
Any idea?


Sign in to comment.

Answers (2)

KSSV on 25 Oct 2016
Open a at the position you want....use:
pos = get(gcf,'position');
pos is 4X1 array, which describes your desired location. Next time when ever you open any figure, you can change it's position using:
set(gcf, 'Position',pos);
Read about position.


Roratonga on 25 Oct 2016
I know, but the figure is anyway movable on the screen. I want to lock its position.
Roratonga on 25 Oct 2016
This sets the default figure position in Matlab. Again I want to create a figure/gui that has a defined position on a screen (I know how to do this) and the created window should not be movable on the screen! (A workaround is to check (Event/Loop) if the position is changed and then move back to inital position)

Sign in to comment.

Fredrik Mile
Fredrik Mile on 2 Mar 2018
I'm facing the same problems right now, did you find a solution for this?

  1 Comment

Marko Hecht
Marko Hecht on 18 Jan 2019
If you are still looking looking for an answer, perhaps this works:
set(gcf,'Position',[x y w h],'Resize','off');

Sign in to comment.

Sign in to answer this question.