Many changes here and there. I lost track... :-(
Current work is on MLSE and SD Decoding etc. MLSE is currently not 100% working, the scalings are maybe off?!
This commit is contained in:
33
Functions/getFigureSize.m
Normal file
33
Functions/getFigureSize.m
Normal file
@@ -0,0 +1,33 @@
|
||||
% GETFIGURESIZE Retrieve the size of the current MATLAB figure window.
|
||||
% [WIDTH, HEIGHT] = GETFIGURESIZE() returns the width and height of the
|
||||
% current figure in pixels.
|
||||
%
|
||||
% Example:
|
||||
% % Get size of current figure
|
||||
% [w, h] = getFigureSize();
|
||||
% fprintf('Current figure is %d pixels wide and %d pixels tall.\n', w, h);
|
||||
%
|
||||
% Adapt snippet for other figures:
|
||||
% % Suppose H is a handle to any MATLAB figure (existing or new):
|
||||
% H = figure; % or H = <some existing figure handle>;
|
||||
% % Retrieve current size of the active (or any) figure:
|
||||
% [wCur, hCur] = getFigureSize();
|
||||
% % Set the other figure H to match that size, preserving its position:
|
||||
% posH = get(H, 'Position'); % [left, bottom, width, height]
|
||||
% newPos = [posH(1), posH(2), wCur, hCur];
|
||||
% set(H, 'Position', newPos);
|
||||
%
|
||||
% Note:
|
||||
% - Position vector is given as [left, bottom, width, height] in pixels.
|
||||
% - If you want to specify a custom size directly, you can replace wCur/hCur
|
||||
% with desired values.
|
||||
|
||||
function [width, height] = getFigureSize()
|
||||
% Ensure a figure is available
|
||||
fig = gcf;
|
||||
% Get the position vector: [left, bottom, width, height]
|
||||
pos = get(fig, 'Position');
|
||||
% Extract width and height
|
||||
width = pos(3);
|
||||
height = pos(4);
|
||||
end
|
||||
Reference in New Issue
Block a user