File Exchange

image thumbnail

Protected Function (P-code) Dependency Analysis Tool

version (744 KB) by Joel Hoff
This tool enables P-code to be used in compiled apps without access to original MATLAB code.


Updated 13 Apr 2017

View License

This tool supports distribution of protected functions (P-code) that can be used to create applications via the MATLAB Compiler. Since the MCC command cannot analyze P-files directly to identify their dependencies, this tool supports a way for MATLAB authors to capture this dependency information into a single separate MATLAB program file that can be distributed with their P-files.
The tool analyzes MATLAB program files to identify their dependencies and writes these out as function pragmas into a separate MATLAB file. The latter pragma file when combined with P-coded versions of the original MATLAB program files can be used with the MATLAB Compiler to create standalone applications without access to the original MATLAB code.

Cite As

Joel Hoff (2020). Protected Function (P-code) Dependency Analysis Tool (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)


Thanks for this very helpful tool!
There seems to be a problem with @-folder classes inside +-folder namespaces. E.g. for a class "test_class" inside the namespace "test_ns", the line that is added is:
%#function test_ns.test_class.test_class
It should be the following line instead, I believe:
%#function test_ns.test_class

Alicia Lotz

Dear Ross, did you get the function to work? I'm still struggling, as the myPragmaFile.m only contains the .p-file and not, as I would expect, the used matlab functions.

Ross Kinard

Note to the other comments. To use it, you unzip the files to a folder, and then copy your main MATLAB script into that folder. Then follow the instructions in the createRequiredFunction.pdf. To make it work with the MATLAB Compiler app it looks like you can add the myPragmaFile.m to the additional files required for installation, and then use the "myapp.m" as the main file. Still working on getting to fully working, but this looks like its getting my in the right direction.

How Can i use this???

How can I analyze the dependency of an existing p file?

MATLAB Release Compatibility
Created with R2014a
Compatible with any release
Platform Compatibility
Windows macOS Linux