Matlab Figure Location in Your Screen

조회 수: 257 (최근 30일)
Guillermo Aldana
Guillermo Aldana 2024년 2월 14일
편집: Vaibhav 2024년 2월 14일
Is there an easy command or setting that allows me to have my plots consistently appear on the right side of my screen without manually specifying their coordinates? I recall having achieved this before, possibly through cascade or aligning them vertically, but I can't seem to remember the exact method.

답변 (1개)

Vaibhav
Vaibhav 2024년 2월 14일
편집: Vaibhav 2024년 2월 14일
Hi Guillermo
I understand that you would like to see the figures on the right side of the screen for every instance.
you can achieve this behavior by setting the default figure position. This involves changing the "DefaultFigurePosition" property of the root graphics object.
Here's how you can set the default figure position so that new figures appear on the right side of the screen:
% Get the screen size
screenSize = get(0, 'ScreenSize');
screenWidth = screenSize(3);
screenHeight = screenSize(4);
% Define the default figure width and height
figWidth = 560; % Default MATLAB figure width
figHeight = 420; % Default MATLAB figure height
% Define an offset from the top of the screen
topOffset = 100; % Adjust this value as needed
% Calculate the position for the new figures
position = [screenWidth-figWidth, screenHeight-figHeight-topOffset, figWidth, figHeight];
% Set the default figure position
set(0, 'DefaultFigurePosition', position);
This code snippet retrieves the screen size and then sets the default figure position to the top-right corner of the screen. You can adjust "figWidth" and "figHeight" to your preferred figure dimensions.
After running this code, any new figures you create will display at the specified position.
Hope this helps!

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by