i have a loop which runs from 1 to 7 producing four different figures per run. How do i automatically save each of these figures inside the loop. The loop is given below.
Show older comments
for n = 1:7
elevation = A_SATPOS(n).ELEV*(180/pi);
for PRN = 8
figure(); %first figure
subplot(2,1,1)
plot(elevation(first_half,PRN,1),MP1(first_half,PRN),'-','LineWidth',1)
ylabel('Multipath [cm]')
ylim([-35 35]);
xlabel('Elevation [degrees]')
%xlabel((sprintf('Time [hours] %s', days{day})))
title (sprintf('GPS L1 [HEL2] 00:00 - 11:59, G%s, %s', satNo{PRN}, days{n}));
%legend('Multipath','Elevation angle')
set(gca,'XLim',[0 90])
set(gca,'XTick',(0:10:90))
grid minor
subplot(2,1,2)
plot(elevation(second_half,PRN,1),MP1(second_half,PRN),'-','LineWidth',1)
ylabel('Multipath [cm]')
ylim([-35 35]);
xlabel('Elevation [degrees]')
%xlabel((sprintf('Time [hours] %s', days{day})))
title (sprintf('GPS L1 [HEL2] 12:00 - 23:59, G%s, %s', satNo{PRN}, days{n}));
%legend('Multipath','Elevation angle')
set(gca,'XLim',[0 90])
set(gca,'XTick',(0:10:90))
grid minor
for ob_type = 1
cno = A_OBS(n).CN0;
figure() %second figure
yyaxis left
plot(new_time, cno(:,PRN,ob_type),'-','LineWidth',1)
ylabel(sprintf('%s, CNO [dB-Hz]', cn0type{ob_type}))
ylim([0 60]);
set(gca,'YTick',(0:5:60))
yyaxis right
plot(new_time, MP1(:,PRN),'-','LineWidth',1)
ylim([-35 35]);
%set(gca,'XLim',[0 60])
set(gca,'XLim',[0 24])
set(gca,'xTick',(0:4:24))
xlabel('GPS Time [hours]')
ylabel('Multipath [cm]')
title (sprintf('GPS L1 [HEL2], G%s, %s', satNo{PRN}, days{n}));
grid minor
legend('CNO','MP')
end
end
%end
%% L2
%for n = 1:7
elevation = A_SATPOS(n).ELEV*(180/pi);
for PRN = 8
figure() % third figure
subplot(2,1,1)
plot(elevation(first_half,PRN,1),MP2(first_half,PRN),'-','LineWidth',1)
ylabel('Multipath [cm]')
ylim([-35 35]);
xlabel('Elevation [degrees]')
%xlabel((sprintf('Time [hours] %s', days{day})))
title (sprintf('GPS L2 [HEL2] 00:00 - 11:59, G%s, %s', satNo{PRN}, days{n}));
%legend('Multipath','Elevation angle')
set(gca,'XLim',[0 90])
set(gca,'XTick',(0:10:90))
grid minor
subplot(2,1,2)
plot(elevation(second_half,PRN,1),MP2(second_half,PRN),'-','LineWidth',1)
ylabel('Multipath [cm]')
ylim([-35 35]);
xlabel('Elevation [degrees]')
%xlabel((sprintf('Time [hours] %s', days{day})))
title (sprintf('GPS L2 [HEL2] 12:00 - 23:59, G%s, %s', satNo{PRN}, days{n}));
%legend('Multipath','Elevation angle')
set(gca,'XLim',[0 90])
set(gca,'XTick',(0:10:90))
grid minor
for ob_type = 2
cno = A_OBS(n).CN0;
figure() % fourth figure
yyaxis left
plot(new_time, cno(:,PRN,ob_type),'-','LineWidth',1)
ylabel(sprintf('%s, CNO [dB-Hz]', cn0type{ob_type}))
ylim([0 60]);
set(gca,'YTick',(0:5:60))
yyaxis right
plot(new_time, MP2(:,PRN),'-','LineWidth',1)
ylim([-35 35]);
%set(gca,'XLim',[0 60])
set(gca,'XLim',[0 24])
set(gca,'xTick',(0:4:24))
xlabel('GPS Time [hours]')
ylabel('Multipath [cm]')
title (sprintf('GPS L2 [HEL2], G%s, %s', satNo{PRN}, days{n}));
grid minor
legend('CNO','MP')
end
end
end
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!