MATLAB Answers

0

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

Asked by Roratonga on 25 Oct 2016
Latest activity Edited by Marko Hecht on 18 Jan 2019
Hi,
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?

  0 Comments

Sign in to comment.

2 Answers

Answer by KSSV
on 25 Oct 2016

Open a figure...place 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.

  3 Comments

I know, but the figure is anyway movable on the screen. I want to lock its position.
Try
set(0,'defaultfigureposition',[x y w h]')
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.


Answer by Fredrik Mile on 2 Mar 2018

Hello!
I'm facing the same problems right now, did you find a solution for this?
Thanks

  1 Comment

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.