MATLAB Matlab gui resize problem

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).
 

Want to reply to this thread?

"Matlab gui resize problem" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving
Top