Plotting multiple matlab figures into a single subplot
1 次查看(过去 30 天)
显示 更早的评论
I used this script to plot 4 matlab figures located in my desktop into a single plot:
Names of the figures: Idc_C1,Idc_C2,Idc_C3 and Idc_C4
clear all;
clc;
c=zeros(4,1);
h=zeros(4,1);
for i=1:4
h(i)=subplot(2,2,i);
end
for k=1:4
% Load saved figures
c(k)=hgload(strcat('C:\Users\kannan\Desktop\PSCAD_Automation_Modell_4T_HBFB\04_Plots\CASE_C1_SEQ_S1\Idc_C',num2str(k)));
% Prepare subplots
figure
% Paste figures on the subplots
copyobj(allchild(get(c(k),'CurrentAxes')),h(k));
end
The problem with the code is that it creates certain duplicated empty figures after the creation of the original subplot.
How should I modify the code to avoid the generation of the empty matlab figures.
Any sugestions or assistance would be very helpful.
0 个评论
采纳的回答
KALYAN ACHARJYA
2020-1-20
编辑:KALYAN ACHARJYA
2020-1-20
Remove figure statement within the loop.
clear all;
clc;
c=zeros(4,1);
h=zeros(4,1);
for i=1:4
h(i)=subplot(2,2,i);
end
for k=1:4
c(k)=hgload(strcat('C:\Users\kannan\Desktop\PSCAD_Automation_Modell_4T_HBFB\04_Plots\CASE_C1_SEQ_S1\Idc_C',num2str(k)));
copyobj(allchild(get(c(k),'CurrentAxes')),h(k));
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subplots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!