主要是用unique命令,你说的删除重复数据,我估计是删除重复行。fp=fopen('data.txt','r');tem1=fscanf(fp,'%f');fclose(fp)tem1=reshape(tem1,5,length(tem1)/5)';[tem2,I,J]=unique(tem1,'rows');tem4=tem1(I,:)结果是:tem4 = 6.0000 5.800 展开
主要是用unique命令,你说的删除重复数据,我估计是删除重复行。fp=fopen('data.txt','r');tem1=fscanf(fp,'%f');fclose(fp)tem1=reshape(tem1,5,length(tem1)/5)';[tem2,I,J]=unique(tem1,'rows');tem4=tem1(I,:)结果是:tem4 = 6.0000 5.8000 2.5000 -1.8000 -1.9000 7.0000 4.1000 4.1000 -0.8000 1.6000 8.0000 2.8000 2.3000 2.2000 -0.5000 9.0000 -1.5000 -1.9000 1.1000 0.9000 10.0000 0.9000 0.2000 0 0.1000 11.0000 2.3000 -3.6000 0.7000 -0.6000 12.0000 -1.2000 -0.4000 -0.2000 -0.1000 13.0000 -4.4000 0.3000 -0.3000 -0.2000 14.0000 -0.9000 0.9000 -0.4000 -0.4000 15.0000 0.8000 1.6000 0 -0.3000 16.0000 2.4000 -0.2000 0.1000 -0.1000 17.0000 2.6000 -0.6000 0.2000 0.2000 18.0000 4.6000 1.0000 0.3000 0.1000 19.0000 2.3000 1.4000 0.9000 0.2000 20.0000 2.4000 0.9000 0.5000 0.4000 收起