expenses_soln.m

来自「ML_01_SOLUTIONS1 ML_01_SOLUTIONS1」· M 代码 · 共 14 行

M
14 行
字号
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);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?