Memory-mapping is a mechanism that maps a file or a portion of a file on disk to a range of addresses within an application's address space. Use memory-mapping when you want to randomly access large files, or frequently access small files. In addition, memory-mapping lets you access file data using standard MATLAB® indexing operations. For more information, see Overview of Memory-Mapping.
memmapfile | Create memory map to a file |
Memory-mapping is a mechanism that maps a portion of a file, or an entire file, on disk to a range of addresses within an application's address space.
Suppose you want to create a memory map for a file named records.dat
,
using the memmapfile
function.
This example shows how to create two different memory maps, and then read from each of the maps using the appropriate syntax.
This example shows how to create three different memory maps, and then write to each of the maps using the appropriate syntax.
To clear a memmapfile
object from memory,
do any of the following:
Share Memory Between Applications
This example shows how to implement two separate MATLAB processes that communicate with each other by writing and reading from a shared file.