正在加载图片...
恒润科技 HiRain Technologies HIRAIN TECHNOLOGIES 解答:低级文本文件MO fid=fopen (monthexpenses txt,'rt)i &Get the first three header lines sentl=fgetl (fid)i sent2=fgetl(fid)i sent=fgetl(fid)i Alternate way of getting the first three header lines 8 for i s 1: 3 8 fgetl(fid)i 8 end numdata=fscanf(fid,oi')i 8 Read in numerical data avg exp=mean(numdata)i fInd the average value high exp=max(numdata)i FInd the maximum value sum exp=sum(numdata)i FInd the sum of the data fclose(fid)ii expenses soln www.hirain.com14 解答:低级文本文件 I/O fid=fopen(‘monthexpenses.txt','rt'); %Get the first three header lines sent1=fgetl(fid); sent2=fgetl(fid); sent3=fgetl(fid); %Alternate way of getting the first three header lines % for i = 1:3 % fgetl(fid); % end numdata=fscanf(fid,'%i'); %Read in numerical data. avg_exp=mean(numdata); %Find the average value. high_exp=max(numdata); %Find the maximum value. sum_exp=sum(numdata); %Find the sum of the data. fclose(fid);; >> expenses_soln
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有