Math::Matlab::Engine - Perl extension for using Matlab from within Perl
use Math::Matlab::Engine; $ep = Math::Matlab::Engine->new(); $ep->PutMatrix('N',2,3,[1,2,3,4,5,6]); $n = $ep->GetGetMatrix('N'); $ep->EvalString("plot(N)");
This module is a wrapper around the C library matlab.h.
$ep = Math::Matlab::Engine->new(); creates a new Math::Matlab::Engine object
$ep->PutMatrix($name, $rows, $columns, $dataref);
This methods hands a matrix with $column columns and $rows rows to Matlab with the name $name. The data is specified by the arrayref $dataref.
EXAMPLE: $ep->PutMatrix('N',3,2,[0,8,15,2,3,9]); writes the matrix "N=[0,8,15;2,3,9]" into matlab's namespace. $n = $ep->GetMatrix($name);
This method retrieves the matlab object $name if it represents a two-dimensional matrix, undef otherwise.
$ep->EvalString($string);
This methods sends an arbitrary string expression to matlab for evaluation, EXAMPLE: $ep->EvalString("[T,Y]=ode23t('func',[0 100],[1,1,1,1])");
$ep->PutArray($name, $dimlistref, $dataref);
This methods hands a multidimensional array to Matlab with the name $name. The dimensions are defined by the arrayref $dimlistref, the data is specified by the arrayref $dataref.
If $p is a pdl object, one can write "$ep->PutArray($name,[$p->dims],[$p->list]);";
$n = $ep->GetArray($name);
This method retrieves the matlab object $name as a multidimensional arrayref.
None by default.
PutArray whirls around the dimensions. I did not find an elegant solution to this problem. For 2-d arrays, use the Matrix methods.
The -Array methods have to be corrected to correctly reflect the numbering of the dimensions
O. Ebenhoeh, <oliver.ebenhoeh@rz.hu-berlin.de>
perl.
To install Math::Matlab::Engine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::Matlab::Engine
CPAN shell
perl -MCPAN -e shell install Math::Matlab::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.