Matlab和Excel交互——数字和列名转换

来源:互联网 发布:js怎么获取时间戳 编辑:程序博客网 时间:2024/05/29 02:40
clcclearclose all% 绘制正四面体FirstPoint = [8 1];SecondPoint = [14 3.5];ThirdPoint = [2 5];FourthPoint = [9 13];xx1 = linspace(FirstPoint(1),SecondPoint(1),10000);yy1 = interp1([FirstPoint(1),SecondPoint(1)],[FirstPoint(2),SecondPoint(2)],xx1);xx2 = linspace(FirstPoint(1),ThirdPoint(1),10000);yy2 = interp1([FirstPoint(1),ThirdPoint(1)],[FirstPoint(2),ThirdPoint(2)],xx2);xx3 = linspace(FirstPoint(1),FourthPoint(1),10000);yy3 = interp1([FirstPoint(1),FourthPoint(1)],[FirstPoint(2),FourthPoint(2)],xx3);xx4 = linspace(SecondPoint(1),ThirdPoint(1),10000);yy4 = interp1([SecondPoint(1),ThirdPoint(1)],[SecondPoint(2),ThirdPoint(2)],xx4);xx5 = linspace(SecondPoint(1),FourthPoint(1),10000);yy5 = interp1([SecondPoint(1),FourthPoint(1)],[SecondPoint(2),FourthPoint(2)],xx5);xx6 = linspace(ThirdPoint(1),FourthPoint(1),10000);yy6 = linspace(ThirdPoint(2),FourthPoint(2),10000);xx = linspace(FourthPoint(1),SecondPoint(1),19);yy = interp1([SecondPoint(1),FourthPoint(1)],[SecondPoint(2),FourthPoint(2)],xx);FinalX(1,7:24) = xx(1,1:18);FinalY(1,7:24) = yy(1,1:18);FinalX(1) = FirstPoint(1);FinalY(1) = FirstPoint(2);FinalX(2) = xx1(523);FinalY(2) = yy1(523);FinalX(3) = SecondPoint(1);FinalY(3) = SecondPoint(2);FinalX(4) = xx2(523);FinalY(4) = yy2(523);FinalX(5) = ThirdPoint(1);FinalY(5) = ThirdPoint(2);FinalX(6) = xx3(523);FinalY(6) = yy3(523);FinalX(25) = FourthPoint(1);FinalY(25) = FourthPoint(2);Data = [0.1977 0.1130 0.0000 0.3672 0.2044 0.1130 0.0000 0.0000 0.0000 0.0001 0.0002 0.0003 0.0004 0.0005 0.0006 0.0006 0.0006 0.0005 0.0004 0.0002 0.0001 0.0001 0.0000 0.0000 0.0000    0.1979 0.1131 0.0004 0.3675 0.0003 0.1131 0.0006 0.0012 0.0025 0.0047 0.0081 0.0125 0.0179 0.0233 0.0274 0.0288 0.0265 0.0212 0.0148 0.0091 0.0050 0.0025 0.0011 0.0004 0.0001    0.1735 0.1129 0.0005 0.2998 0.0002 0.1077 0.0007 0.0016 0.0034 0.0064 0.0111 0.0176 0.0254 0.0333 0.0392 0.0409 0.0378 0.0310 0.0227 0.0151 0.0092 0.0052 0.0027 0.0013 0.0003       ];TitleData = [2.5,0.1; 2.5,1; 2.5,1.4];Label = {'(a)' '(b)' '(c)'};W = get(0,'ScreenSize');figure;set(gcf,'Position',[0.1*W(3) 0.3*W(4) 0.8*W(3) 0.4*W(4)]);for jj = 1:1:3        SubName{1} = subplot(1,3,jj);    set(SubName{1},'Position',[0.05+0.3*(jj-1) 0.05 0.27 0.85]);    scatter(xx1,yy1,0.6,'k','.');    hold on;    scatter(xx2,yy2,0.6,'k','.');    hold on;    scatter(xx3,yy3,0.6,'k','.');    hold on;    scatter(xx4,yy4,0.6,'k','.');    hold on;    scatter(xx5,yy5,0.6,'k','.');    hold on;    scatter(xx6,yy6,0.6,'k','.');    hold on    c = Data(jj,:);    scatter(FinalX,FinalY,[],c,'filled','MarkerEdgeColor',[0 .5 .5]);    CBar = colorbar;    load Mymap;    colormap(Mymap);    axis([0 18 0 16]);    axis off;    text(FirstPoint(1)-1,FirstPoint(2)-0.5,'L','FontSize',14);    text(SecondPoint(1)+1,SecondPoint(2),'P','FontSize',14);    text(ThirdPoint(1)-2,ThirdPoint(2),'D','FontSize',14);    text(FourthPoint(1),FourthPoint(2)+1,'C','FontSize',14);    text(ThirdPoint(1)-2,16,cell2mat(Label(jj)),'FontSize',15);    title(['r = ' num2str(TitleData(count,1)) ',\sigma = ' num2str(TitleData(count,2))]);end  
原创粉丝点击