這是我的劇情代碼。問題是我的情節中的兩條線具有相同的顏色,我需要一個特殊的情節(共4行)。我需要不同的顏色在我的matlab陰謀
for i=1:nFolderContents;
[~, data] = hdrload(folderContents(i,:));
if size(folderContents(i,:),2)<size(folderContents,2);
temp=folderContents(i,6:9);
else
temp=folderContents(i,6:7);
end
temp1(i)=strread(temp);
w=2*pi*(data([35 51 68 101],1));
permfreespace=8.854e-12;
perm=data([36 52 69 101],3);
cond=perm.*w.*permfreespace;
conds([36 52 69 101],i)=cond;
hold on
end
figure(4);plot(temp1,conds);
gcf=figure(4);
set(gcf,'Position', [0 0 295 245]);
xlabel('Temperature [\circC]'), ylabel ('Conductivity [s/m]');
title('Different frequencies');
legend('1.02 GHz','1.50 GHz','2.01 GHz','3 GHz');
axis([20 52 0 4]);
box on
新代碼:
conds=zeros(101,28);
for i=1:nFolderContents;
[~, data] = hdrload(folderContents(i,:));
if size(folderContents(i,:),2)<size(folderContents,2);
temp=folderContents(i,6:9);
else
temp=folderContents(i,6:7);
end
temp1(i)=strread(temp);
w=2*pi*(data([35 51 68 101],1));
permfreespace=8.854e-12;
perm=data([36 52 69 101],3);
cond=perm.*w.*permfreespace;
conds([36 52 69 101],i)=cond;
hold all
end
diff = hsv(101);
for i=1:101
figure(4),plot(temp1(1,:),conds(i,:),'color',diff(i,:));
hold all;
end
gcf=figure(4);
set(gcf,'Position', [0 0 295 245]);
xlabel('Temperature [\circC]'), ylabel ('Conductivity [s/m]');
title('Different frequencies');
legend('1.02 GHz','1.50 GHz','2.01 GHz','3 GHz');
axis([20 52 0 4]);
box on
的問題是,我在圖例框獲得相同的顏色了。
使用'hold all'而不是'hold'# – Dan
仍然存在同樣的問題 – yaya
'temp1'和'conds'的尺寸是多少? – Dan