Skip to content

Commit 91383c5

Browse files
committed
Fix figure positioning to use correct handle
Replaces 'gcf' with 'h' in the set function to ensure the correct figure handle is used when setting position and units. This prevents potential issues when multiple figures are open or when 'h' is not the current figure.
1 parent 2596732 commit 91383c5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

SavePDF.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
end
6060
fig_w = 11*px_sz;
6161
fig_h = 8.5*px_sz;
62-
set(gcf, 'Units', 'Pixels', 'Position', [(scr_sz(3)-fig_w)/2, (scr_sz(4)-fig_h)/2, fig_w, fig_h]);
62+
set(h, 'Units', 'Pixels', 'Position', [(scr_sz(3)-fig_w)/2, (scr_sz(4)-fig_h)/2, fig_w, fig_h]);
6363

6464
% Create output folder
6565
if ~MRS_struct.p.bids

0 commit comments

Comments
 (0)