- #1
boolean_logic
- 2
- 0
I have been trying the following to reposition my GUI (within the OpeningFcn):
h=get(handles.figure1,'Position');
set(0,'Units','normalized')
S = get(0,'screensize');
width = h(3);
height=h(4);
x = (S(3) - width)/2;
y = (S(4) - height)/2;
set(handles.figure1,'Position',[x,y,width,height]);
However this results in the Gui being position in an unexpected position. I am not sure why this is but the problem persists even if I replace set(handles.figure1,'Position',[x,y,width,height]) with set(handles.figure1,'Position',S) - I expected this change in code to result in a full screen gui however the position was offset (the width and height appeared correct though).
h=get(handles.figure1,'Position');
set(0,'Units','normalized')
S = get(0,'screensize');
width = h(3);
height=h(4);
x = (S(3) - width)/2;
y = (S(4) - height)/2;
set(handles.figure1,'Position',[x,y,width,height]);
However this results in the Gui being position in an unexpected position. I am not sure why this is but the problem persists even if I replace set(handles.figure1,'Position',[x,y,width,height]) with set(handles.figure1,'Position',S) - I expected this change in code to result in a full screen gui however the position was offset (the width and height appeared correct though).