When I run a .m file containing a .p datafile I get the following error message:
The P-code file /Users/....
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.
How should I use pcode to regenerate the file as suggested by the hint?
I try to type pcode filename and pcode(filename) but without any success. Any suggestions? Also I should mention that the .m does not work because of this problem so I cannot simply ignore the warning.
Pcode files are byte code translated matlab functions, which are heavily obfuscated during that process.
To solve this problem, you have to get the original m-function which was used to create the pcode file. It typically has the same file name with a different extension. Then you could run pcode again, or use the m-code.
Related
I have an third-party file with the extension .p and I try if it is possible to open it using the function fopen:
fopen(title.p)
This returns 3, which is a file identifier according to the help function:
help fopen
fopen - Open file, or obtain information about open files
This MATLAB function opens the file, filename, for binary read access, and returns an integer file identifier equal to or greater than 3.
What should I do to see (if possible) the content of the file?
A file with the extension .p in the context of matlab probably refers to a pcode file. It is obfuscated bytecode, you won't be able to read anything useful. Nevertheless you can run the function calling it like any other matlab function.
I was able to open the file using
fid = fopen('file.p')
fgetl(fid)
However, the content was not useful, indeed.
I m working on a Matlab project and I need UsbWebcams package for capture image from webcam. I can run .m file in matlab but when I compile project to create an exe file, My exe file return an error because usbWebcams package have some special .p files(Utility.p,webcamchannel.p etc) and I can not use these file for compiling.I searced on Internet and I didnt find any answer for this. How can I use .p files in my project. I think there should be a solution and I should find it. Thanks for helping to all.
Although MATLAB Compiler should be able to compile .p files, it's possible that the .p files you're trying to compile may have dependencies that you can't see because they're p-coded. For example, they might call an external library (this is quite possible if they are for interfacing with a webcam), or they might call another function using eval.
Whether they're .m files or .p files, if the files you're trying to compile have a dependency of this sort you need to include it explicitly for the Compiler, otherwise it won't know where to find it. But if the file is p-coded, it's tough to find out what the dependencies might be. You might need to ask MathWorks directly for support in compiling this functionality.
I have a precompiled static library propa64.a, which i want to use in Matlab in Linux.
No source code of it available, only header file (propa.h). As far as i understand, to use it in Matlab i need to create mex file. How can i do it, without source and with only compiled propa64.a?
mex propa64.a
doesn't work, matlab says "mex: no filename given" error.
Any suggestions?
Or , may be it's possible to use pre-compiled static library in Matlab somehow else?
How to lock MATLAB files keeping them executable.
I am writing code to create GUI where third party should run the .fig file but should be unable to read the code written. Main GUI editor file contains user defined functions also, where they should be locked too with capability of execution.
Thank you in advance.
You can p-code your MATLAB functions:
http://www.mathworks.co.uk/help/matlab/matlab_prog/protect-your-source-code.html
I'm trying to open a .mat file in the windows environment but it is failing. It was created in a Unix environment. Also note that this file was first put in a .tar file first, ftp via binary method. The file opens in Unix and I don't think it was corrupted in any way.
The *.mat file format is platform agnostic. The OS does not matter.
There are a number of variants of the *.mat file which have been used, and older versions cannot always read formats saved with newer versions. You can save to an older version using flags available in the save command. These formats have been updated as the Matlab feature set has demanded a more flexible file format, and as other technologies have advanced, most notably HDF5 in the recent version.
Finally, the save command supports an ASCII formatted option. I suspect this is your current problem, based on your comment regarding the error message received.
To address your current problem:
First, check to see if the file is an ASCII file. The easiest way is to simply open it in notepat, wordpad, or even the matlab editor. If the file is text, then this becomes a file parsing problem, and the appropriate use of fscanf shoudl fix the problem.
If the file is actually a binary *.mat file then you probably have a Matlab version incompatability. Yuo can either go back to the source unix environment and save to an older version (eg save .... -v7) or update the Matlab version of the reading computer.