admin管理员组

文章数量:1293693

When on remote desktop, for all my colleagues and myself, matlab creates a figure that is for half outside of the screen and we cant see it until you enlarge it. Is there a permanent fix that doesnt require changing updating all our hundreds matlab scripts? If not, what are the best lines of code to have this working in general (remotely or locally) It doesnt happen if we open it locally.

When on remote desktop, for all my colleagues and myself, matlab creates a figure that is for half outside of the screen and we cant see it until you enlarge it. Is there a permanent fix that doesnt require changing updating all our hundreds matlab scripts? If not, what are the best lines of code to have this working in general (remotely or locally) It doesnt happen if we open it locally.

Share Improve this question asked Feb 12 at 16:30 MillemilaMillemila 1,6604 gold badges25 silver badges47 bronze badges 1
  • set(gcf,"Position",[200,200,200,200]), where gcf gets the figure handle, the 4 element vector is (L to R) [X, Y, width, height] on screen. This could be done inside a program or in the command window at any time. – X Zhang Commented Feb 13 at 5:03
Add a comment  | 

1 Answer 1

Reset to default 0

You can set the default figure position using

set(groot, 'DefaultFigurePosition', [x, y, width, height])

Ref this MATLAB Answers question: https://uk.mathworks/matlabcentral/answers/526580-change-de-default-position-of-plot

You could set this on startup, or before you run some code, and optionally reset it when you're done (I believe it will reset on MATLAB restart anyway). You can get the position before changing it with pos = get(groot, 'DefaultFigurePosition');, you could also use the existing default to preserve the width and height whilst changing x and y.

本文标签: