www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ReadEntireFileofDoublePrecisionDataExample.m
%% Read Entire File of Double-Precision Data % Copyright 2015 The MathWorks, Inc. %% % Create a file named |doubledata.bin|, containing nine double-precision % values. fileID = fopen('doubledata.bin','w'); fwrite(fileID,magic(3),'double'); fclose(fileID); %% % Open the file, |doubledata.bin|, and read the data in the file into a % 3-by-3 array, |A|. Specify that the source data is class |double|. fileID = fopen('doubledata.bin'); A = fread(fileID,[3 3],'double') %% % Close the file. fclose(fileID);