S
scottmf
I am not sure if this is more of an issue with Matlab or Perl, but here
is what I am having trouble doing:
I want a user to be able to start Matlab (on a WinXP machine) and run a
matlab program like perl_link.m below that runs a perl script. The
perl script then parses a large data file and stores the results in
several arrays in matlab using OLE objects. The rest of the matlab
program then processes those arrays. I have been able to get the
perl->matlab OLE interface work if I start matlab from within the perl
script using
$ML = Win32::OLE->new('Matlab.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start MATLAB";
But I cannot find the matlab OLE object if I start matlab first and run
the perl script from inside matlab.
This is the kind of output I would expect to see from running the
matlab program:
# Object=Win32::OLE=HASH(0x183ef90) Class=DIMLApp
Found 1 OLE Object(s)
Instead I don't fine any OLE objects. Any suggestions or additional
documentation I haven't yet found would be very helpful.
Here are the matlab and perl files I am using:
Perl_link.m:
function perl_link
%
%% would like to use test.pl to parse some large data file and store
the
%% information in arrays in matlab
!perl test.pl
%% Would then like to use matlab to do some processing on the arrays
and
%% plot the results
Test.pl:
#!/usr/bin/perl -w
#
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Variant;
my $Count;
$Count = Win32::OLE->EnumAllObjects(sub {
my $Object = shift;
my $Class = Win32::OLE->QueryObjectType($Object);
printf "# Object=%s Class=%s\n", $Object, $Class;
});
print "Found $Count OLE Object(s)\n";
is what I am having trouble doing:
I want a user to be able to start Matlab (on a WinXP machine) and run a
matlab program like perl_link.m below that runs a perl script. The
perl script then parses a large data file and stores the results in
several arrays in matlab using OLE objects. The rest of the matlab
program then processes those arrays. I have been able to get the
perl->matlab OLE interface work if I start matlab from within the perl
script using
$ML = Win32::OLE->new('Matlab.Application', sub {$_[0]->Quit;})
or die "Oops, cannot start MATLAB";
But I cannot find the matlab OLE object if I start matlab first and run
the perl script from inside matlab.
This is the kind of output I would expect to see from running the
matlab program:
# Object=Win32::OLE=HASH(0x183ef90) Class=DIMLApp
Found 1 OLE Object(s)
Instead I don't fine any OLE objects. Any suggestions or additional
documentation I haven't yet found would be very helpful.
Here are the matlab and perl files I am using:
Perl_link.m:
function perl_link
%
%% would like to use test.pl to parse some large data file and store
the
%% information in arrays in matlab
!perl test.pl
%% Would then like to use matlab to do some processing on the arrays
and
%% plot the results
Test.pl:
#!/usr/bin/perl -w
#
use strict;
use warnings;
use Win32::OLE;
use Win32::OLE::Variant;
my $Count;
$Count = Win32::OLE->EnumAllObjects(sub {
my $Object = shift;
my $Class = Win32::OLE->QueryObjectType($Object);
printf "# Object=%s Class=%s\n", $Object, $Class;
});
print "Found $Count OLE Object(s)\n";