How to run a p code matlab?

I have a list of p codes downloaded online. I need to know how to run these files in Matlab? Thanks for all your help!

 Risposta accettata

Walter Roberson
Walter Roberson il 20 Giu 2016

2 voti

pcode files are always functions; just call them the same way as you would any ordinary function.

Più risposte (4)

Shameer Parmar
Shameer Parmar il 20 Giu 2016

6 voti

.p files are the end user code, which we can't see like any other .m files.
to run the .p files, simply keep it in your current directory of matlab,
  • Method 1:
Right click on file and select 'run'.
  • Method 2:
Simply type the filename on command window (without extension).
  • Method 3:
Create one .m file, put names of all .p files (without extension) followed by the semicolon, and then run that .m file.

2 Commenti

Sami Ullah
Sami Ullah il 13 Ott 2020
Facing following error while executing as per your guideline. kindly help

Accedi per commentare.

Satyaki Chaudhuri
Satyaki Chaudhuri il 21 Nov 2016

0 voti

I came across a very similar situation. You can run them as function files but you got to ""run as administrator" while opening matlab. This enables it to run the .p files as functions.

2 Commenti

You should not need "run as administrator" for most of them. It is possible that some might need to make changes to your configuration so you might need to run as administrator. But I have my usual suspicions about code that cannot be seen and which needs to make changes to protected configuration.
Jan
Jan il 5 Apr 2017
Modificato: Jan il 5 Apr 2017
You cannot read the contents of a P-file. If such a function asks for admin privileges, I'd be very suspicious. I would not trust the code without a really good reason: Written confirmation of the author what happens inside and a sha256 hash of the file.

Accedi per commentare.

Kola  Murali
Kola Murali il 5 Apr 2017
Modificato: Walter Roberson il 5 Apr 2017

0 voti

The P-code file D:\videos\matlab\matlab\webcamprot\facewebcam.p was generated prior to MATLAB version 7.5 (R2007b) and is no longer supported. Use pcode to regenerate the file using MATLAB R2007b or later.
what can i do

1 Commento

You ask the author of the code to generate a new version for you. There is no way for you to "upgrade" the .p file: it needs to be done by someone who has the original .m that the .p file was created from.
It appears to me that the author was probably Luigi Rosa
Looking around, it appears to me that another alternative would be for you to install R2013a or earlier to run the program. (I am not sure which version exactly was the last one the program could be run with.)

Accedi per commentare.

Ila Sharma
Ila Sharma il 4 Ott 2018

0 voti

i couldn't run .p file in Matlab, please help me out

4 Commenti

Is there an error message?
Ila Sharma
Ila Sharma il 4 Ott 2018
yes, in this file one function file named as timebar.p file) is called, and due to .p version it is not running
the error comes as-: Undefined function 'timebar' for input arguments of type 'char'.
Error in SwarmFish_demo_SO_std (line 138) SwarmFish_Procedure_h = timebar('SwarmsLAB::SwarmFish','Total Progress...');
The version of that in the File Exchange is missing files, it appears. There seems to be a complete version at https://onedrive.live.com/?id=A569FA949D5A7AB5%212372&cid=A569FA949D5A7AB5 . I have verified that timebar.p from there works.
Ila Sharma
Ila Sharma il 4 Ott 2018
thank you very very much sir, now it is running.. Thank you for your time...

Accedi per commentare.

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by