Plotting multiple matlab figures into a single subplot

1 visualización (últimos 30 días)
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.
problem.png

Respuesta aceptada

KALYAN ACHARJYA
KALYAN ACHARJYA el 20 de En. de 2020
Editada: KALYAN ACHARJYA el 20 de En. de 2020
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

Más respuestas (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by