MATLAB v5 workspace file

application/x-matlab-data

Safe

Magic Bytes

Offset: 0
4D 41 54 4C 41 42

The MATLAB v5 workspace file is a binary data container format developed by MathWorks for storing variables, functions, and arrays. It is primarily used to serialize and persist workspace data, including multidimensional arrays and structures, allowing researchers to save progress or exchange datasets between computing environments. While the format is historically standard and safe for data storage, newer MATLAB versions increasingly utilize HDF5-based structures for handling larger datasets and improved interoperability.

Extension

.mat

MIME Type

application/x-matlab-data

Byte Offset

0

Risk Level

Safe

Validation Code

How to validate .mat files in Python

Python
def is_mat(file_path: str) -> bool:
    """Check if file is a valid MAT by magic bytes."""
    signature = bytes([0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42])
    with open(file_path, "rb") as f:
        return f.read(6) == signature

How to validate .mat files in Node.js

Node.js
function isMAT(buffer: Buffer): boolean {
  const signature = Buffer.from([0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42]);
  return buffer.subarray(0, 6).equals(signature);
}
Go
func IsMAT(data []byte) bool {
    signature := []byte{0x4D, 0x41, 0x54, 0x4C, 0x41, 0x42}
    if len(data) < 6 {
        return false
    }
    return bytes.Equal(data[:6], signature)
}

API Endpoint

GET /api/v1/mat
curl https://filesignature.org/api/v1/mat

Related Formats