What Is an M File?

A file with the M file extension could belong to one of several file formats, but many of them are related in some way to a source code file. One is the MATLAB source code format. These are text files that store scripts and functions for the MATLAB program to use for running mathematical actions to plot graphs, run algorithms, and more. The file works the same way as running commands through the MATLAB command line, but makes it much easier to re-run common actions. A similar use for M files is with the Mathematica program. It’s also a text-based file format that stores instructions that the program can use to run certain math-related functions. Objective-C implementation files use this file extension, too. These are text files that hold variables and functions used within the context of application programming, usually for macOS and iOS devices. Some M files are instead source code files written in the Mercury programming language. It’s unlikely that this is the type of file you have, but yet another use for this file extension is for music used to emulate instruments on Japanese PC-98 computers.

How to Open an M File

MATLAB Source Code files can be created by and opened with a text editor like Notepad in Windows or Notepad++. However, MATLAB M files aren’t actually usable unless they’re opened within the MATLAB program. You can do this through the MATLAB prompt by entering the filename, like myfile.m. M files used by Mathematica will, of course, open with that program. Since they’re just text files, this also means that you can open it with a text editor, but the same concept applies to MATLAB files in that they’re only usable within the context of Mathematica. Since class implementation files are text, they can be used with any text editor already mentioned, including ones like jEdit and Vim. However, these M files aren’t applicable until they’re utilized with Apple Xcode or some other related compiler. Mercury-related files are similar to the other text-based file formats from above, but are really only useful with winmercury or this Mercury compiler. PC-98 M files can be opened with FMPMD2000. You also need to make sure that you’ve got two DLL files: WinFMP.dll and PMDWin.dll. You can grab them from this download page.

How to Convert an M File

Most of the text editors linked on this page can convert an M file to another text-based format, like HTML or TXT. This only applies to the text formats, though, not something else like a PC-98 audio file. To save the code in an M file to PDF is possible with MATLAB. With the file open, look for an Edit M File Configuration or some sort of Export or Save as menu. If you want to convert a different M file to PDF, one that isn’t related to MATLAB, try one of these free PDF printers. MATLAB Compiler can convert these files to EXE for use with MATLAB Runtime, which allows MATLAB apps to run on computers that don’t have the software installed.

Still Can’t Open It?

Some files are easily confused with others because their file extensions share common letters. It’s possible that you don’t really have an M file, and that’s why it’s not working with the M openers or converters from above. This file extension is clearly just one letter long, so while it might seem unlikely that you’d get it mixed up with a different file that belongs to a different file format, it’s still important to double-check. For example, there are several file formats that use M to identify the file, like M3U, M2 and M3 (Blizzard object or model), M4A, M4B, M2V, M4R, M4P, M4V, etc. If you check the file extension of your file and notice that it belongs to one of those formats, then use the link provided or research the suffix to learn how to open it. If you do in fact have an M file, but it’s not opening with the suggestions on this page, it’s possible that you have a really obscure format. Use a text editor like Notepad++ to open it as a text document. There might be some words or phrases in there that give away the program that made it, or describe what’s used to open it.