How to invert .p file to .m file

166 vues (au cours des 30 derniers jours)
file123
file123 le 13 Fév 2018
I have a file with a .p extension. How can I convert to .m file?
  2 commentaires
recent works
recent works le 3 Nov 2022
not possible. only .m files to .p files possible.
Babawuya
Babawuya le 29 Août 2023
Déplacé(e) : Bruno Luong le 29 Août 2023
how can i convert a matlab p-code file to m file

Connectez-vous pour commenter.

Réponse acceptée

ES
ES le 13 Fév 2018
You cant do that.
https://in.mathworks.com/help/matlab/ref/pcode.html
  5 commentaires
Steven Lord
Steven Lord le 13 Fév 2018
If you're not sure what your professor has asked you to do, you probably need to ask them to clarify.
From the portion of your assignment that you've quoted, it doesn't sound like your professor wants you to reverse engineer the signal1 function. It sounds like they want you to treat it as a "black box" and write code that uses the signal that black box emits.
Stephen23
Stephen23 le 13 Fév 2018
"How can i solve this problem?"
What problem? You can use that .p file without converting it to anything else (that is the whole point of them). The task you were given even tells you exactly how: "To evaluate this function, simply type y = signal1(t) where t is a vector containing values of time".

Connectez-vous pour commenter.

Plus de réponses (3)

recent works
recent works le 3 Nov 2022
not possible. only .m files to .p files possible. mainly .p files helps to protect the important files

Benjamin Kraus
Benjamin Kraus le 13 Fév 2018
By design, there is no way to convert a P-coded file (a file with the .p extension) into a regular MATLAB file (a file with the .m extension). The conversion from MATLAB file to P-coded file is a one-way conversion. As the description on the pcode doc page ("Create protected function file") states, the purpose of creating a P-coded file is to obfuscate the code to protect the source code. If you could reverse the operation, there would be no point in converting to a P-file.

Walter Roberson
Walter Roberson le 29 Août 2023

There is no documented way to convert p files to m files, and Mathworks will not assist you in converting files.

There have been at least three versions of p files. The first version was in use until about 2010. The second version was in use until a small number of releases ago, and the third version is now in use.

A small number of people outside of Mathworks demonstrated that they were able to convert version 2 p files to m files. None of the people who I was aware of ever provided a commercial service to do the conversion. I was aware of one person who provided a free service, but stopped doing so a number of years ago.

Whether it is legal for people outside Mathworks to convert third-party p files to m files depends on the jurisdiction. In the USA, the encoding done to produce p files would definitely qualify for protection in law, and so in the USA the only people legally permitted to decode third party files would be qualified security researchers, or university students in computer security courses acting under the direction of qualified security researchers — or, people with disabilities who were adapting programs for use with assistive devices for their own personal use (yes, this does mean that if you are someone who physically cannot do the adaptation then you cannot get anyone to do it for you! It is not a good law.)

The laws are different in some other countries, especially Germany, but the relevant laws are mostly driven by entertainment companies (copy protection / digital rights) who have managed to create fairly powerful lobbyists, so the laws are a fair bit more restrictive in many countries than most people would expect.

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by