Why my plotting curves exceed the loop index?

1 view (last 30 days)
Why I see three plotting curves while my loop index j runs twice?
close all;
clear all;
clc;
%% ------------------------------Program-------------------------------------
z=2860:11:3135;
FOV=[1 2];
n=2;
col=['r' 'b'];
[m,~]=size(n);
lineHandles = gobjects(1,m);
for i=1:length(FOV)
for j=1:n
figure (3),
hold on
I0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_I0.dat']);
Q0= getsignal([num2str(j),'FOV_',num2str(FOV(i)),'mrad\out_resultsG_Q0.dat']);
I(i,:)= smooth(sum(I0,2));
Q(i,:)= smooth(sum(Q0,2));
dep(i,:)= (I(i,:)-Q(i,:))./(I(i,:)+Q(i,:));
depr(i,:)=(dep(1,:)./dep(2,:));
plot(depr(i,:),z,'LineWidth',1.5,'color',col(:,j));
title('\fontname{Arial}Inhomogeneous clouds','Fontsize',12);
%legend('\delta_{in}/\delta_{out}','location','Southeast');
legend('CM1','CM2','location','Southeast');
xlabel('Depolarization ratio \delta_{rat}');
ylabel('\fontname{Arial}Cloud depth (m)');
set(gca,'color','w','Fontsize',12,'LineWidth',1,'Fontweight','normal');
set(gca,'box','off','Fontname','Arial','Fontsmoothing','on');
set(gca,'xlim',[0 1.6],'xtick',[0:0.2:1.6],'ylim',[2850 3150],'ytick',[2850:60:3150]);
set(gca,'xgrid','on','ygrid','on','gridcolor','k')
end
end

Answers (1)

Sulaymon Eshkabilov
Sulaymon Eshkabilov on 25 May 2021
Hi,
There might be a couple or more possible cases. Presumably (preassumption without seeing your data), one of your imported data sets contains two sets of data instead of one.
Don'r foget to use hold off as well once all done. This could be another possible case scenario.

Community Treasure Hunt

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

Start Hunting!