%% Map Entire File of Double-Precision Data
% Create a memory map for double-precision data. The syntax is similar when specifying other data types.
% At the command prompt, create a sample file in your current folder called records.dat, containing 10 double values.

myData = (1:10)';

fileID = fopen('records.dat','w');
fwrite(fileID,myData,'double');
fclose(fileID);

%
% Create a memory map for records.dat, and set the Format property for the output to 'double'.

m = memmapfile('records.dat','Format','double') ;

%
% The memmapfile, m, contains the following properties: Filename, Writable, Offset, Format, Repeat, and Data. To display any one property, for example Format, type m.Format in the command window.

m.Format

% The Data property contains the 10 double-precision values in records.dat.
% Copyright 2012 The MathWorks, Inc.