其中与图像内容相关的子对象为:Children和CurrentAxes。
每个坐标轴对象(CurrentAxis)又有自己的子对象:
解决方法:
如果将两个图做为子图重绘到新的figure,即需要将其中的坐标轴对象导出,复制到新的figure的子图中。关于因子图及和积算法的基础程序
程序如下:
clear;
clc;
close all;
t = 0:0.001:10;
y1 = sin(t);
y2 = cos(t);
figure(1);
plot(t,y1);
figure(2);
plot(t,y2);
fig(1) = get(figure(1), 'CurrentAxes');
fig(2) = get(figure(2), 'CurrentAxes');
figure(3);
subplot(2,1,1);
axChildren = get(fig(1),'Children');
copyobj(axChildren, gca);
subplot(2,1,2);
axChildren = get(fig(2),'Children');
copyobj(axChildren, gca);
程序运行结果:
figure 1:
figure 2:
figure 3: