

#Matlab p file to m file converter code#
It is not recommended that you P-code files to protect your intellectual property.Īs a side-note, something similar can be seen when calling the source code of built-in functions, e.g. p file is difficult to understand, it should not be considered secure. For P-files of Matlab 6 there are some further techniques to get the contents of the original file, but for the modern Matlab versions the P-files are encrypted. When MATLAB P-codes a file, the file is obfuscated not encrypted. function y myfunc (x) y sqrt (x.3 + x.2 + x + 1) end. p file extension), and distribute your application code in this format. In a file named myfunc.m in your current folder, define a function that returns the square root of a cubic polynomial. See protect your source code by The MathWorks (emphasis mine):ĭeploy as P-code - Convert some or all of your source code files to a content-obscured form called a P-code file (from its. I convert these file to m-file so that I can read the source code of the algorithm.

This means that the possibility to de-obfuscate exists. P files is just obfuscation not encryption or compilation. M file only needs to contain the help comments.Ĭonverting. P file exist, MATLAB will call the P-file for execution, so the. Note that you don't have to actually call foo.p inside your foo.m function: M-file with the same name containing the help section. The officially promoted way of including a help section after obfuscation is to write a separate. This means that any comments in the code, including the help section, will not be available after obfuscation. By design pcode() only contains parsed MATLAB code.
