Perl in MATLAB for Windows

I now need to run a piece of code for many days, with many variants, on a hefty server (running Windows).  The main piece of code is written for MATLAB and calls a piece of Perl code.

I downloaded and installed the correct version (64-bit) Strawberry Perl. I followed the download instructions, added the correct environment variables, and completed the installation. However, MATLAB was using a crippled version of Perl.

After installing Perl, I needed the package random.pm. So, I issued the command

c:cpan Math::Random

and Strawberry Perl went and downloaded the module from CPAN. I could run the code that I needed from the command prompt, but not from inside MATLAB.

I used a solution from this site. Unfortunately, the perl.exe wasn’t where it was supposed to be. The true directory is

c:Program FilesMATLABR2010asysperlwin32bin>.

Here, I simply (as per the directions) renamed perl.exe to perl-matlab.exe. Now, my code runs excellently using the MATLAB command

>>perl('script.pl','arg1','input1','arg2','input2',...)

I hope this helps someone else out.

Good luck!

rsl

Leave a Reply