figure pop outside the screen

조회 수: 107 (최근 30일)
Yoshi Ri
Yoshi Ri 2018년 2월 4일
편집: SREEJITH VS 2024년 2월 2일
Hi. I have trouble with a default figure position.
Somehow my figure always comes outside the window. If I reset the default figure position like below, the figure still appears outside the valid screen.
set(0, 'DefaultFigurePosition', [0 0 400 300]);
figure()
Does anybody know the good way to fix this problem?
和文
matlabの図が画面外に出る現象に困っています。 DefaultFigurePositionを設定しても,画面外右に出てくるのでMATLABのディスプレイ認識が間違っているのではと思っていますがPCごと再起動しても改善されません。 どうすればよいでしょうか。
  댓글 수: 3
michio
michio 2018년 2월 4일
This might be related to your issue. Are you using MATLAB via remote access or do you have multiple screens?
What does the following reply?
get(0,'ScreenSize')
Yoshi Ri
Yoshi Ri 2018년 2월 5일
편집: Yoshi Ri 2018년 2월 7일
Thank you for your comment. Though I read that article, I can not get any idea to solve this situation. Here is my result.
>> get(0,'ScreenSize')
ans =
1 1 1536 864
>> get(0, 'MonitorPositions')
ans =
1 -215 1920 1080
-2399 -485 2400 1350
I use one additional screen at left side of the main screen, and my figure appears on the right side of the main screen.

댓글을 달려면 로그인하십시오.

채택된 답변

michio
michio 2018년 2월 6일
Thanks! I forgot to ask. What version of MATLAB are you using and on what OS?
Also please note that MATLAB sets the display size values for this property at startup. The values are static and your system display settings change do not reflect on those values. MATLAB needs to restart to refresh the value.
See: https://jp.mathworks.com/help/matlab/ref/root-properties.html describes the properties related to the graphics.
One thing caught my attention is your numbers do not seem to be in pixel. As stated in the "Units" property of the following page, 'ScreenSize' and 'MonitorPosition' will in pixel by default setting. Could you try the following to double check?
get(0, 'Units');
get(0, 'MonitorPositions');
I am guessing if your 'Unit' is not in pixels (and if you did't change it), it could indicate that there are some scripts that do changes the graphics properties at start-up. Any ideas?
startup.m is one possibility.
Could you check if you have startup.m by executing
which -all startup
Another thing you can try is to refresh your prefdir folder, which contains preferences, history, and layout file. You can delete the folder and restart MATLAB.
View the location of the preferences folder by
prefdir
  댓글 수: 3
michio
michio 2018년 2월 7일
Just to clarify, what happens if you comment out all the command on your startup.m and restart MATLAB?
Just wanted to double check the values of defaultfigurepositon without startup.
michio
michio 2018년 2월 7일
Also on prefdir, you can make a backup copy of the original folder and put them back later with the same name. Then any setting you currently have will be restored.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

SREEJITH VS
SREEJITH VS 2024년 2월 2일
편집: SREEJITH VS 2024년 2월 2일
After figure add this line
movegui('center');

카테고리

Help CenterFile Exchange에서 グラフィックス オブジェクトのプロパティ에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!