How to use Matlab toolboxes consist of .p suffix? [duplicate] - matlab

This question already has an answer here:
How use pcode to regenerate a file in MatLab?
(1 answer)
Closed 6 years ago.
I have Matlab toolbox contains files with .p suffix.
I've set path it but when I've run main files of toolbox this error appeared :
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.
Is there any way to use this toolbox for newer versions of matlab like 2011 or newer?

A p-code file is an obfuscated version of an m-file that should not be readable by the recipient; however, MATLAB is still able to read and interpret these files as though they were the original (unobfuscated) m-files.
As the error states, an older version of MATLAB was used to generate the p-code files you have and therefore it may not be compatible with the version of MATLAB that you are using.
You would need to get a copy of the original m-files as there is no reliable way to "recompile" a p-code file. You would need to run pcode on the original m-files to generate new/compatible p-files.
This may require that you get in touch with the original developer.
That being said, it should just be a warning and you should be able to still use the files with the caveat that there may be unexpected behavior.

Related

Demo code from the MVGC Toolbox documentation not working on R2018b

I need help in using the MVGC (Multivariate Granger Causality) Toolbox for MATLAB.
I tried to execute the demo code which is provided here, but the code is not executing properly, since many of the functions (e.g rng_seed(), var5_test()) do not exist in MATLAB.
I searched for those in the MATLAB support but was unable to find any information regarding them.
The short answer is: it's likely not related to the specific MATLAB version, and you should just include the toolbox in your search path.
The functions aren't identified because they're not part of the MATLAB installation, but are rather included in the toolbox itself (which you should download manually). Then, for them to be recognized, download the toolbox, extract it, and add the contents of the toolbox (including subfolders) to your MATLAB path.
Specifically regarding the functions you mentioned, they're found here:
var5_test -> \mvgc_v1.0\demo\var5_test.m
rng_seed -> \mvgc_v1.0\utils\rng_seed.m

How do you use the LaTeX blackboard font in MATLAB? (2019)

My question is: How can I use Latex mathbb fonts in Matlab.
Furthermore, I have no rights to change Matlab files on my PC.
I do not want to use psfrag, suggested sometimes as a solution, since some of my figures generated with Matlab are pictures and they get really big if they are exported to eps.
I am using Matlab 2017a.
Note:
This is a follow up question to How do you use the LaTeX blackboard font in MATLAB?.
The answer to this question seems outdated. My
MATLAB root\toolbox\matlab\graphics file contains no matlab commands anymore; it seems to be a precompiled file now.
Thus the approach from the original does not work.

MATLAB to C code conversion [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Matlab to C or C++
is there any software to convert MATLAB code to c....
Yes. Embedded Matlab. Works well but only allows use of a subset of matlab functions.
http://www.mathworks.co.uk/products/featured/embeddedmatlab/
It is fine for converting your algorithms into C without having to worry about the possibility of errors being introduced in hand conversion. you will need a license for rtw.
http://www.mathworks.co.uk/products/rtw/
MATLAB is able to compile your .m files to binary files if you just want them to run faster:
http://www.mathworks.com/help/toolbox/compiler/mcc.html
If C++ is acceptable, you could try a library such as Armadillo, which provides C++ versions of many MATLAB functions. This allows for a relatively easy conversion of many functions.

How can I get a list of all the defined variables in Matlab or Octave?

I'm used to working in Matlab using its full GUI environment. Due to license issues I went and installed Octave, but it appears that it doesn't have a GUI, at least not one that's installed by default.
I transferred the variables from Matlab to Octave by saveing them in Matlab and loading them in Octave. Thing is, I don't remember the names because I got used to seeing them in the little workspace window which I no longer have.
How can I see the list of defined variables and their types in Octave?
The command whos will do just that.
With the command whos you can even see the variables that the file has WITHOUT opening the file, to be assure that this file is the one.
For example, the name of the file is MyVariables.mat
use:
whos('-file','MyVariables.mat')
You can use a GUI similar to Matlab, such as QtOctave or GUIOctave.

running old mex file on new matlab releases

I'm trying to run a program originally tested on Matlab 6.5 on a new release (R2009a)
The program uses some mex files, and I get the following error when trying to run it:
??? Invalid MEX-file '/normalizedCut/common_files/sparsifyc.mexglx':
normalizedCut/common_files/sparsifyc.mexglx: symbol mxGetIr, version
libmx.INTERNAL not defined in file libmx.so with link time reference.
(the code I'm trying to tun is Normalized cut by Shi & Malic, and can be found here:
http://www.cis.upenn.edu/~jshi/software/files/NcutClustering_7.zip)
If I try to run the code on the same system but Matlab 2007a it runs ok.
Is there some problem with backwards compatibility for 2009a?
Are there any flags somewhere in the system I can change to help it work?
When I googled it I saw some references to the LD_LIBRARY_PATH env variable, but what exactly should be added to it I could not find out.
Thanks,
Yair
The source code for those mex functions appears to be available in the "Image segmentation with normalized cuts" source on this page: http://www.cis.upenn.edu/~jshi/software/ (in the specific_NcutImage_files subdirectory in the unpacked .zip)
It's pretty common for there to be problems running mex functions with different versions of Matlab. The errors you're getting look like they're due to API changes in Matlab (though that surprises me a little). I've had the most trouble because of binary incompatibilities induced by changes in gcc. I'd suggest contacting Jiambo and asking him if he can build a new version or release the source.
Worst case, you could try re-implementing those mex functions. The normalized cut algorithm is pretty straightforward in Matlab (see the Shi and Malik paper). By the names of the mex functions, they look like they're mostly duplicating existing matlab functionality (matrix multiplication, matrix sparsification). There's a non-zero chance that if you re-implemented them as regular m-code functions they'd be faster anyway due to the multicore support that's been added to Matlab.