The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Matlab - An abstract base class for a simple Matlab API.

SYNOPSIS

  If MyMatlab is a sub-class of Math::Matlab ...

  use MyMatlab;
  $matlab = MyMatlab->new( { %args } );
  
  my $code = q/fprintf( 'Hello world!\n' );/
  if ( $matlab->execute($code) ) {
      print $matlab->fetch_result;
  } else {
      print $matlab->err_msg;
  }

DESCRIPTION

Math::Matlab is an abstract class for a simple interface to Matlab, a mathematical computation package from The MathWorks (for more info on Matlab, see http://www.mathworks.com/).

METHODS

Public Object Methods

execute
 $success = $matlab->execute($matlab_code, @args)

An abstract method which executes the Matlab code passed in the first argument and returns true if successful. The handling of any additional arguments are determined by the implementing sub-class. The output of the Matlab code is stored in the object to be retreived by one of the following 4 methods. The Matlab code must print all output to STDOUT.

get_result
 $str = $matlab->get_result
 $str = $matlab->get_result( $str )

Returns the Matlab output after stripping the extra junk.

fetch_result
 $str = $matlab->fetch_result
 $str = $matlab->fetch_result( $str )

Returns the Matlab output after stripping the extra junk, then deletes it from memory.

get_raw_result
 $str = $matlab->get_raw_result
 $str = $matlab->get_raw_result( $str )

Returns the Matlab output in raw form. Can be helpful for debugging errors.

fetch_raw_result
 $str = $matlab->fetch_raw_result
 $str = $matlab->fetch_raw_result( $str )

Returns the Matlab output in raw form, then deletes it from memory. Can be helpful for debugging errors.

err_msg
 $str = $matlab->err_msg
 $str = $matlab->err_msg( $str )

Returns the most recent error message. Or sets the message to be returned.

Private Object Methods

_getset
 $value = $object->_getset($field)          ## get a field's value
 $value = $object->_getset($field, $value)  ## set a field's value

A utility method used to get or set a field in the object.

COPYRIGHT

Copyright (c) 2002, 2007 PSERC. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

  Ray Zimmerman, <rz10@cornell.edu>

SEE ALSO

  perl(1), Math::Matlab::Local, Math::Matlab::Remote, Math::Matlab::Server