Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] Using Perl within Matlab ; something wrong with path?

Expand Messages
  • Jenda Krynicky
    To: perl-beginner@yahoogroups.com ... It seems that the Perl included with Matlab is fairly dated. The globbing used to be done via an external program, but
    Message 1 of 2 , Nov 21, 2005
    • 0 Attachment
      To: perl-beginner@yahoogroups.com
      > OK, hope someone can help me out here...
      > So, I want to write a perl script. I have matlab which also seems to
      > contain perl. I can run a perl script from the matlab prompt by
      > typing > perl ('johnsprogram.pl) and that works OK.
      > The problem is that I need to do what I think is called globbing. I
      > want to say, list all the folders / files in a directory and then do
      > something to each one.
      > But when I try some code like:
      > while ($nextname = </etc/host*>) {
      > print "one of the files is $nextname\n";
      > }
      > I get the error message
      > System error: 'perlglob' is not recognized as an internal or external
      > command,operable program or batch file. glob failed (child exited with
      > status 1) at ga.pl line 7.
      > If I run this same program from within the folder where the
      > perlglob.exe command is located
      > C:\MATLAB6p5\sys\perl\win32\bin
      > it works.
      > But I can't get it to work from another folder. How do I teach Matlab
      > or perl to find that command? I do have this folder added to the
      > Matlab path, but maybe it needs to be added to the perl path somehow?
      > Or is there a better way for me to use the Matlab perl from a
      > different environment?

      It seems that the Perl included with Matlab is fairly dated. The
      globbing used to be done via an external program, but that has long
      been changed. I think the best option would be to install a recent
      ActivePerl (http://www.activestate.com/Products/ActivePerl/) and tell
      Matlab where to find it. (Sorry, I've never worked with Matlab
      myself. Maybe you'll just need to change a path in some Matlab
      configuration, maybe you'll have to install the ActivePerl into the
      same path that the current one resides in. Don't forget to make a
      backup of the old perl of course!)

      If this is not an option (eg. the Matlab's Perl has been modified to
      work with Matlab), either add the C:\MATLAB6p5\sys\perl\win32\bin
      into the system variable PATH (rightclick My Computer, select
      Properties\Advanced\Environment Variables) or copy the perlglob.exe
      into a directory that is in PATH.

      HTH, Jenda
      ===== Jenda@... === http://Jenda.Krynicky.cz =====
      When it comes to wine, women and song, wizards are allowed
      to get drunk and croon as much as they like.
      -- Terry Pratchett in Sourcery
    Your message has been successfully submitted and would be delivered to recipients shortly.