# M File Extension

Have a problem opening a .M file? We collect information about file formats and can explain what M files are. Additionally we recommend software suitable for opening or converting such files.

Have a problem opening a .M file? We collect information about file formats and can explain what M files are. Additionally we recommend software suitable for opening or converting such files.

Primarily, the .m extension is associated with the MATLAB Script/Function (.m) file type. MATLAB (Matrix Laboratory) by MathWorks, Inc. is the oldest and most established proprietary software system for applied mathematical computations. Despite strong competition, MATLAB still retains leadership in academic, scientific and industrial circles.

MATLAB uses .m files (also referenced as 'M-files') both as script files and functions definitions. A MATLAB script (.m) is a text-based file that contains a program, i.e. a series of instructions in the MATLAB language, and can be directly run by MATLAB by invoking the script filename. A MATLAB function definition file (.m) is exactly the same as a script file, with the only difference being that it defines a system-wide function instead of storing a script.

Both MATLAB function definition and script files must be placed in locations included in the PATH variable. MATLAB M-files can be directly created and edited with any text editor.

Alternatively, the .m extension also associates with the Wolfram Mathematica Package (.m) file type. Wolfram Mathematica is one of the most powerful and fast integrated environments, targeting computationally-intensive tasks in industry, science, and education. Package files (.m) are text-based ASCII files used to store various data in Mathematica, including source code (scripts), images, geometry shapes, etc.

Maple, another advanced applied-mathematics computational environment (Windows/Unix/Mac OS/Linux) by Maplesoft, uses the .m extension as a label for the Maple internal binary object format. In contrast to text-based .mpl (Maple Language) files, .m files are binary files that cannot be directly edited. Such .m files are used to store variables and other Maple objects, and are readable in Maple only (the "read" statement).

With reference to GNU Octave, an advanced cross-platform FOSS (Free and Open-Source Software) application and scripting platform for intensive mathematical computations, the .m extension acts as a label for plaintext Octave script files. Very similar in syntax to MATLAB scripts, Octave .m files contain series of MATLAB-compatible text-based instructions, to be executed by GNU Octave as a batch.

Apart from that, the .m extension also denotes the Objective-C Class Implementation (.m) file type. Objective-C is the most commonly-used OO (object-oriented) programming language in application development for Mac OS and iOS. An .m file is a plaintext file with a set of instructions that implements an Objective-C class. Class implementation files (.m) are always used in pairs with their respective header files (.h).