forked from rozenasf/Matlab2Powerpoint
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMatlab2Powerpoint_Position.m
More file actions
26 lines (19 loc) · 895 Bytes
/
Matlab2Powerpoint_Position.m
File metadata and controls
26 lines (19 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function [X_Location,Y_Location] = Matlab2Powerpoint_Position(Matlab_Obj,Ax,Powerpoint_Obj)
%Pos = Matlab_Obj.Position;
Pos=[0,0];
Axes_Position = Ax.Position;
MatlabSize = Matlab_Obj.Extent;
X_extent = MatlabSize(1) + MatlabSize(3)/2;
Pos(1) = X_extent;
Xlim = Ax.XLim;
X_Axes_fraction = (Pos(1) - Xlim(1)) ./ (Xlim(2) - Xlim(1));
X_Figure_fraction = X_Axes_fraction * Axes_Position(3) + Axes_Position(1);
X_Location = Powerpoint_Obj.Left + (Powerpoint_Obj.Width) * X_Figure_fraction;
% Pos(2) = -1;
Ylim = Ax.YLim;
Y_extent = MatlabSize(2) + MatlabSize(4)/2;
Pos(2) = Y_extent;
Y_Axes_fraction = (Pos(2) - Ylim(1)) ./ (Ylim(2) - Ylim(1));
Y_Figure_fraction = 1 - (Y_Axes_fraction * Axes_Position(4) + Axes_Position(2));
Y_Location = Powerpoint_Obj.Top + (Powerpoint_Obj.Height) * Y_Figure_fraction;
end