MPP (Matlab PreProcessor)
Updated 19 May 2016
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.
Paul Mennen (2023). MPP (Matlab PreProcessor) (https://www.mathworks.com/matlabcentral/fileexchange/7150-mpp-matlab-preprocessor), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.