No BSD License  

Highlights from
MPP (Matlab PreProcessor)

4.0

4.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 133.59 KB File ID: #7150

MPP (Matlab PreProcessor)

by Paul Mennen

 

15 Mar 2005 (Updated 17 Mar 2005)

C programmers may miss having a preprocessor. Here is one tailored just for MATLAB.

| Watch this File

File Information
Description

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.

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (1)
25 May 2005 Peter Li

Nice idea, useful if you want to define preprocessor constants. Unfortunately I want to define preprocessor macros and the current MPP (ver. 1.6) is quite limited for this. Having real C-style preprocessor macros could cut a lot of simple function calls out of for-loops, which could really speed things up.

MPP could also be improved with a simple .m file that will search your MatLab path and run MPP on any .mi files it finds. This would be perhaps ideally incorporated into the rehash function, but since that's a builtin it's probably better not to go there.

Sorry, but I can't help implement these improvements at the moment, but I will keep checking in.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
development environment Paul Mennen 22 Oct 2008 07:43:24
preprocessor Paul Mennen 22 Oct 2008 07:43:24
c programmers Paul Mennen 22 Oct 2008 07:43:24
mpp Paul Mennen 22 Oct 2008 07:43:24
utilities Paul Mennen 22 Oct 2008 07:43:24
development Paul Mennen 22 Oct 2008 07:43:24

Contact us at files@mathworks.com