Main Content

Memory Mapping

Map file data to memory for faster access

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.

Functions

memmapfileCreate memory map to a file

Topics

  • Overview of Memory-Mapping

    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.

  • Map File to Memory

    Suppose you want to create a memory map for a file named records.dat, using the memmapfile function.

  • Read from Mapped File

    This example shows how to create two different memory maps, and then read from each of the maps using the appropriate syntax.

  • Write to Mapped File

    This example shows how to create three different memory maps, and then write to each of the maps using the appropriate syntax.

  • Delete Memory Map

    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.