MPP (Matlab PreProcessor)

C programmers may miss having a preprocessor. Here is one tailored just for MATLAB.
Updated 19 May 2016

No License

If MATLAB was your first or primary programming language, you probably will never miss having a preprocessor. However if you have gravitated to MATLAB from a background in C programming you might wonder where MATLAB's pre-processor is. Well MATLAB doesn't come with one.MPP was designed to fill this void.

True, you could use your favorite C preprocessor on MATLAB code, but there are several reasons you will find this inconvenient. For example, a C preprocessor makes no effort to preserve line numbers, so when MATLAB reports an error at line #n, you don't know where to go in your source file to fix the problem. MPP on the other hand, does preserve line numbers and also has many other features tailored to the needs of a MATLAB programmer.

An example is given to show how you can use MPP to make a MatLab GUI application more readable and easier to modify. MPP is not limited to any particular MATLAB version. It will work as smoothly with version 3.0 as it will with 7.0.

An executable is provided for Microsoft Windows environments and a few flavors of Unix. If I don't have the executable for your target, it is easy to compile it yourself since the complete source code for MPP is included. Of course you are welcome to modify MPP if doesn't work the way you would prefer.

Cite As

Paul Mennen (2024). MPP (Matlab PreProcessor) (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Find more on Programming in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes