本文共 330 字,大约阅读时间需要 1 分钟。
clear all;clc;fid=fopen('data1.txt','r');%通过fopen创建fidi=1;while ~feof(fid)%~feof(fid)循环到文件结束处 name(i,:)=fscanf(fid,'%5c',1);% '%5c'表示读取字符的位数(5位)其他的不读取,1->表示读取的个数 year(i)= fscanf(fid,'%d',1); no1(i)=fscanf(fid,'%d',1); no2(i)=fscanf(fid,'%d',1); no3(i)=fscanf(fid,'%g',1); no4(i)=fscanf(fid,'%g\n'); i=i+1;end
转载地址:http://bxmen.baihongyu.com/