ATLAB画图之多个图以子图的形式合为一个图

其中与图像内容相关的子对象为: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:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值