将数据A存入D盘test文件夹下MyData.dat文件中,代码如下:

fopen('D:testMyData.dat','ab');

fwrite(f,A,'double');

fclose(f);

读取文件:

fopen('D:testMyData.dat','rb');

x=fread(f,'double');

fclose(f);

显示并求和:

disp(x')

sum(x)