Programming Previous page   Next Page

Creating P-Code Files

You can save a preparsed version of a function or script, called P-code files, for later MATLAB sessions using the pcode function. For example,

parses average.m and saves the resulting pseudocode to the file named average.p. This saves MATLAB from reparsing average.m the first time you call it in each session.

MATLAB is very fast at parsing so the pcode function rarely makes much of a speed difference.

One situation where pcode does provide a speed benefit is for large GUI applications. In this case, many M-files must be parsed before the application becomes visible.

You can also use pcode to hide algorithms you have created in your M-file, if you need to do this for proprietary reasons.


Previous page  Providing Help for Your Program M-File Scripts and Functions Next page

© 1994-2005 The MathWorks, Inc.