Convert m File into p File in MATLAB

Hello friends, I hope you all are doing great. In today's tutorial, I am going to show you How to Convert m File into p File in MATLAB. Now the question arises that why we need to do that? & the answer is if you want to protect your code and don't want anyone to access it then you need to your Convert m File into p File. P File is like an encrypted file which performs the same functionality as your original m file but no one can get the code out of it. Like me explain it with an example, suppose you are some sort of developer and you have created some code for a company and now you want to protect your code and just send the company some sort of software. MATLAB has a function in which you convert your m-file into p-file and no one can open that p file code. P-file functionality is as same as of m-file but no one can check what's inside p-file.

Convert m File into p File in MATLAB

  • Suppose you have created your m-file and you are now want to protect your code and the send the rest to your employer so that he can use it without knowing the code inside it.
  • Use these command to do this :
pcode(fun) pcode(fun1,...,funN)
  • If fun is the name of the m-file then MATLAB will conver the fun.m to fun.p and create it in the same folder.
  • If fun is the name of the folder then MATLAB will convert all the m-files within that folder into p-files.
  • If you want to convert more than one m-file into p-file then use the second code and place all the m-files there.
  • You can also convert more than one folder using the second command.
So, that's all for today. In my next post I will tell you a way of protecting your simulink model in the same way as we protected our m-file. Till then take care & stay blessed .... :))
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir