Matlab Figure Location in Your Screen
215 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
回答 (1 件)
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!
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!