golib  0.5
goMatlab Class Reference

Matlab interface. More...

#include <gomatlab.h>

Public Member Functions

bool putString (const goString &, const char *name)
 Put a string to the matlab engine. More...
 
bool getString (goString &str, const char *name)
 Get a string variable from matlab. More...
 
bool putRGBImage (const goSignal3DBase< void > *sig, const char *name)
 Puts a multichannel signal as RGB image to matlab. More...
 
bool putSignal (const goSignal3DBase< void > *sig, const char *name)
 Put a single channel of sig as matrix to matlab. More...
 
bool getSignal (goSignal3D< void > *sig, const char *name)
 Get a matlab matrix as goSignal3D. More...
 
bool putArray (const goDouble *p, goSize_t length, const char *name)
 Put a C array to matlab. More...
 
bool putArray (const goArray< goDouble > *array, const char *name)
 Put a resizable array to matlab. More...
 
bool getArray (goArray< goDouble > *array, const char *name)
 Get array from matlab. More...
 
bool putVector (const goMath::Vectord *vec, const char *name)
 Put a goVector to matlab. More...
 
bool getVector (goMath::Vectord *vec, const char *name)
 Get a vector from matlab into a goVector. More...
 
bool putVector (const goMath::Vectorf *vec, const char *name)
 Put a goVector to matlab. More...
 
bool getVector (goMath::Vectorf *vec, const char *name)
 Get a vector from matlab into a goVector. More...
 
bool putDouble (goDouble d, const char *name)
 Put a double value to matlab. More...
 
bool getDouble (goDouble &d, const char *name)
 Get a double from matlab. More...
 
bool putSparse (goSparseMatrix *sm, const char *name)
 Put a sparse matrix stored in a goSparseMatrix. More...
 
bool putMatrix (const goMath::Matrixf &matrix, const char *name)
 
bool getMatrix (goMath::Matrixf &matrix, const char *name)
 
bool putMatrix (const goMath::Matrixd &matrix, const char *name)
 
bool getMatrix (goMath::Matrixd &matrix, const char *name)
 
bool put2DPoints (const goList< goMath::Vectorf > &l, const char *variableName)
 Put 2d points from list to matlab matrix. More...
 
bool put2DPoints (const goList< goMath::Vectord > &l, const char *variableName)
 Put 2d points from list to matlab matrix. More...
 
bool get2DPoints (goList< goMath::Vectorf > &l, const char *variableName)
 Get a matrix of 2d points from matlab into a list. More...
 
bool get2DPoints (goList< goMath::Vectord > &l, const char *variableName)
 Get a matrix of 2d points from matlab into a list. More...
 
bool put2DPoints (goList< goMath::Vectorf >::ConstElement *begin, goIndex_t size, const char *variableName)
 
bool put2DPoints (goList< goMath::Vectord >::ConstElement *begin, goIndex_t size, const char *variableName)
 
bool startEngine ()
 Starts a new matlab engine. More...
 
bool stopEngine ()
 Stops the matlab engine. More...
 
Engine * getEngine ()
 Get the matlab engine structure. More...
 
const Engine * getEngine () const
 Get the matlab engine structure. More...
 
mxArray * matlabCreateMatrix (int rows, int columns)
 
mxArray * matlabCreateSparse (int rows, int columns, int elements)
 
bool copyToMatlab (const goSignal3DBase< void > *sig, mxArray *matrix)
 
bool copyToMatlab (const goArray< goDouble > *array, mxArray *matrix)
 
bool copyToMatlab (const goMath::Vectord *array, mxArray *matrix)
 
bool copyToMatlab (const goMath::Vectorf *array, mxArray *matrix)
 
bool copyToMatlab (const goDouble *array, goSize_t length, mxArray *matrix)
 
bool copyToMatlab (goSparseMatrix *sp, mxArray *matrix)
 
bool copyFromMatlab (mxArray *matrix, goSignal3DBase< void > *sig)
 
bool copyFromMatlab (mxArray *matrix, goArray< goDouble > *array)
 
bool copyFromMatlab (mxArray *matrix, goMath::Vectord *array)
 
bool copyFromMatlab (mxArray *matrix, goMath::Vectorf *array)
 
bool sparseToMatlabSparse (goSparseMatrix *sp, const char *name)
 
bool signalToVariable (const goSignal3DBase< void > *sig, const char *name)
 
bool arrayToVariable (const goArray< goDouble > *array, const char *name)
 
bool arrayToVariable (const goDouble *array, goSize_t length, const char *name)
 
bool doubleToVariable (goDouble d, const char *name)
 
bool variableToSignal (goSignal3D< void > *sig, const char *name)
 
bool variableToSignal (goSignal3DBase< void > *sig, const char *name)
 
bool variableToArray (goArray< goDouble > *vector, const char *name)
 
bool variableToDouble (goDouble &d, const char *name)
 
bool matlabCall (const char *command, goString *resultBuffer=0)
 Execute matlab command. More...
 
bool call (const char *command, goString *resultBuffer=0)
 Synonym for matlabCall. More...
 
virtual bool callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 
- Public Member Functions inherited from goObjectBase
 goObjectBase ()
 Constructor.
 
virtual ~goObjectBase ()
 Destructor. More...
 
const char * getClassName () const
 Returns the class name. More...
 
int getClassID () const
 
virtual goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 
void setObjectName (const char *name)
 Set name string for an object. More...
 
void setObjectName (const goString &name)
 Set name string for an object. More...
 
const goStringgetObjectName () const
 Get the object name. More...
 
virtual bool writeObjectFile (FILE *) const
 Write object to a file. More...
 
virtual bool readObjectFile (FILE *)
 Read object from a file. More...
 
void connectObject (goObjectBase *object)
 Connects an object to this object. More...
 
void disconnectObject (const goObjectBase *object)
 Disconnects an object from this object.
 
virtual bool queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false)
 Enqueue a method call to an internal list of methods. More...
 
bool callQueuedMethods ()
 Call all queued methods. More...
 

Additional Inherited Members

- Protected Member Functions inherited from goObjectBase
void setClassID (int id)
 Sets the class name.
 
void printClassMessage (const char *msg)
 Sets the class name. More...
 
void printClassMessage (goString &msg)
 Prints an informational message to the calling console. More...
 
void sendObjectMessage (int messageID, void *data=NULL)
 Sends a message to all connected objects.
 
void sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL)
 Sends a message to a specific object.
 
virtual void receiveObjectMessage (const goObjectMessage &message)
 Receive a message. More...
 

Detailed Description

Matlab interface.

Note
You need Matlab in order to use this.

This class provides a convenient interface to use matlab in conjunction with some objects from golib. A simple usage example would be

  ...
  goMatlab matlab;  // This starts the matlab engine.
  goMath::Matrixf M;
  ... // Do some stuff with M
  matlab.putMatrix (M, "mymatrix");
  matlab.call ("v = mymatrix * something; % Do whatever you want matlab to do with the data");
  // Say "v" in matlab is a vector, then
  goMath::Vectorf v;
  matlab.getVector (&v, "v");
  ... // Do some stuff with v
Todo:
The interface is a little inconsistent (use references instead of pointers!).

The documentation for this class was generated from the following files: