pcbway




com port in matlab, send data to matlab,com port matlab,data sending com port in matlab, com port in matlabHello 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 …. :))

2 Comments

  1. @ Jia Khan This problem is because of some programming issue …. as it shows you have some empty string in your m-file which is making problem …. debug your code at line 80 …

    If the problem still remains let me know … I will find some other solution ….. and its better if you first convert a simple m file into p file for just your testing ….

Leave a Reply

Your email address will not be published. Required fields are marked *

Post comment