golib  0.5
Matlab

goMatlab offers an interface to the matlab engine and some convenience functions to get and put golib object from and to the matlab engine. It is in the separate library Gomatlab, which can be built optionally. Also available are a few mex modules for some tasks. The only interesting will probably be the video4linux interfaces. More...

Files

file  matlab/mex/videocapture/videocapture.cpp
 
file  videocaptureclose.cpp
 
file  videocaptureopen.cpp
 

Classes

class  goMatlab
 Matlab interface. More...
 
class  goMatlabPrivate
 

Functions

bool goMatlab::putString (const goString &, const char *name)
 Put a string to the matlab engine. More...
 
bool goMatlab::getString (goString &str, const char *name)
 Get a string variable from matlab. More...
 
bool goMatlab::putRGBImage (const goSignal3DBase< void > *sig, const char *name)
 Puts a multichannel signal as RGB image to matlab. More...
 
bool goMatlab::putSignal (const goSignal3DBase< void > *sig, const char *name)
 Put a single channel of sig as matrix to matlab. More...
 
bool goMatlab::getSignal (goSignal3D< void > *sig, const char *name)
 Get a matlab matrix as goSignal3D. More...
 
bool goMatlab::putArray (const goDouble *p, goSize_t length, const char *name)
 Put a C array to matlab. More...
 
bool goMatlab::putArray (const goArray< goDouble > *array, const char *name)
 Put a resizable array to matlab. More...
 
bool goMatlab::getArray (goArray< goDouble > *array, const char *name)
 Get array from matlab. More...
 
bool goMatlab::putVector (const goMath::Vectord *vec, const char *name)
 Put a goVector to matlab. More...
 
bool goMatlab::putVector (const goMath::Vectorf *vec, const char *name)
 Put a goVector to matlab. More...
 
bool goMatlab::getVector (goMath::Vectord *vec, const char *name)
 Get a vector from matlab into a goVector. More...
 
bool goMatlab::getVector (goMath::Vectorf *vec, const char *name)
 Get a vector from matlab into a goVector. More...
 
bool goMatlab::putDouble (goDouble d, const char *name)
 Put a double value to matlab. More...
 
bool goMatlab::getDouble (goDouble &d, const char *name)
 Get a double from matlab. More...
 
bool goMatlab::putSparse (goSparseMatrix *sm, const char *name)
 Put a sparse matrix stored in a goSparseMatrix. More...
 
bool goMatlab::put2DPoints (const goList< goMath::Vectorf > &l, const char *variableName)
 Put 2d points from list to matlab matrix. More...
 
bool goMatlab::put2DPoints (const goList< goMath::Vectord > &l, const char *variableName)
 Put 2d points from list to matlab matrix. More...
 
bool goMatlab::get2DPoints (goList< goMath::Vectorf > &l, const char *variableName)
 Get a matrix of 2d points from matlab into a list. More...
 
bool goMatlab::get2DPoints (goList< goMath::Vectord > &l, const char *variableName)
 Get a matrix of 2d points from matlab into a list. More...
 
bool goMatlab::put2DPoints (goList< goMath::Vectorf >::ConstElement *begin, goIndex_t size, const char *variableName)
 
bool goMatlab::put2DPoints (goList< goMath::Vectord >::ConstElement *begin, goIndex_t size, const char *variableName)
 
bool goMatlab::stopEngine ()
 Stops the matlab engine. More...
 
Engine * goMatlab::getEngine ()
 Get the matlab engine structure. More...
 
const Engine * goMatlab::getEngine () const
 Get the matlab engine structure. More...
 
bool goMatlab::startEngine ()
 Starts a new matlab engine. More...
 
bool goMatlab::sparseToMatlabSparse (goSparseMatrix *sp, const char *name)
 
bool goMatlab::signalToVariable (const goSignal3DBase< void > *sig, const char *name)
 
bool goMatlab::arrayToVariable (const goArray< goDouble > *array, const char *name)
 
bool goMatlab::arrayToVariable (const goDouble *array, goSize_t length, const char *name)
 
bool goMatlab::doubleToVariable (goDouble d, const char *name)
 
bool goMatlab::variableToSignal (goSignal3D< void > *sig, const char *name)
 
bool goMatlab::variableToArray (goArray< goDouble > *vector, const char *name)
 
bool goMatlab::variableToDouble (goDouble &d, const char *name)
 
bool goMatlab::variableToSignal (goSignal3DBase< void > *sig, const char *name)
 
mxArray * goMatlab::matlabCreateSparse (int rows, int columns, int elements)
 
mxArray * goMatlab::matlabCreateMatrix (int rows, int columns)
 
bool goMatlab::copyToMatlab (const goSignal3DBase< void > *sig, mxArray *matrix)
 
bool goMatlab::copyToMatlab (const goArray< goDouble > *array, mxArray *matrix)
 
bool goMatlab::copyToMatlab (const goMath::Vectord *array, mxArray *matrix)
 
bool goMatlab::copyToMatlab (const goMath::Vectorf *array, mxArray *matrix)
 
bool goMatlab::copyToMatlab (const goDouble *array, goSize_t length, mxArray *matrix)
 
bool goMatlab::copyToMatlab (goSparseMatrix *sp, mxArray *matrix)
 
bool goMatlab::copyFromMatlab (mxArray *matrix, goSignal3DBase< void > *sig)
 
bool goMatlab::copyFromMatlab (mxArray *matrix, goArray< goDouble > *array)
 
bool goMatlab::copyFromMatlab (mxArray *matrix, goMath::Vectord *array)
 
bool goMatlab::copyFromMatlab (mxArray *matrix, goMath::Vectorf *array)
 
bool goMatlab::matlabCall (const char *command, goString *resultBuffer=0)
 Execute matlab command. More...
 
bool goMatlab::call (const char *command, goString *resultBuffer=0)
 Synonym for matlabCall. More...
 
virtual bool goMatlab::callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 

Detailed Description

goMatlab offers an interface to the matlab engine and some convenience functions to get and put golib object from and to the matlab engine. It is in the separate library Gomatlab, which can be built optionally. Also available are a few mex modules for some tasks. The only interesting will probably be the video4linux interfaces.

Function Documentation

◆ call()

bool goMatlab::call ( const char *  command,
goString resultBuffer = 0 
)

Synonym for matlabCall.

Parameters
commandCommand
resultBufferResult buffer.
Returns
True if successful, false otherwise.

◆ callObjectMethod()

bool goMatlab::callObjectMethod ( int  methodID,
goObjectMethodParameters param = NULL 
)
virtual

Call an object method by identifier.

See the file goobjectmessage.h for messages and add messages there if needed. External applications building on this class should use identifiers starting with GO_OBJECTMETHOD_USER.

Note
Reimplement this in sub-classes as needed. The method should return true if the method call was successful. Values can also be returned through the goObjectMethodParameters* param.
Parameters
methodIDID of the method. See goobjectmethod.h
paramPointer to parameters for the method, if any.
Returns
True if successful, false otherwise.

Reimplemented from goObjectBase.

◆ get2DPoints() [1/2]

bool goMatlab::get2DPoints ( goList< goMath::Vectord > &  l,
const char *  variableName 
)

Get a matrix of 2d points from matlab into a list.

Stores the points from a matrix that looks like described in the documentation of goMatlab::put2DPoints() into a list.

See also
goMatlab::put2DPoints()
Parameters
lThe list.
variableNameThe matlab variable name of the matrix containing the coordinates.
Returns
True if successful, false otherwise.

◆ get2DPoints() [2/2]

bool goMatlab::get2DPoints ( goList< goMath::Vectorf > &  l,
const char *  variableName 
)

Get a matrix of 2d points from matlab into a list.

Stores the points from a matrix that looks like described in the documentation of goMatlab::put2DPoints() into a list.

See also
goMatlab::put2DPoints()
Parameters
lThe list.
variableNameThe matlab variable name of the matrix containing the coordinates.
Returns
True if successful, false otherwise.

◆ getArray()

bool goMatlab::getArray ( goArray< goDouble > *  array,
const char *  name 
)

Get array from matlab.

Parameters
arrayHolds the array on successful return.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ getDouble()

bool goMatlab::getDouble ( goDouble &  d,
const char *  name 
)

Get a double from matlab.

Parameters
dVariable to hold the result.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ getEngine() [1/2]

Engine * goMatlab::getEngine ( )

Get the matlab engine structure.

Returns
Pointer to the matlab Engine structure.

◆ getEngine() [2/2]

const Engine * goMatlab::getEngine ( ) const

Get the matlab engine structure.

Returns
Const pointer to the matlab Engine structure.

◆ getSignal()

bool goMatlab::getSignal ( goSignal3D< void > *  sig,
const char *  name 
)

Get a matlab matrix as goSignal3D.

Parameters
sigPointer to a goSignal3D<void> that holds the data on successful return. If the size of sig does not match the matrix, or if its type is not GO_FLOAT, the type is set to GO_FLOAT and it is resized.
nameName of the matlab variable.
Returns
True if successful, false otherwise.

◆ getString()

bool goMatlab::getString ( goString str,
const char *  name 
)

Get a string variable from matlab.

Parameters
strHolds the string on successful return.
nameName of the matlab variable.
Returns
True if successful, false otherwise.

◆ getVector() [1/2]

bool goMatlab::getVector ( goMath::Vectord vec,
const char *  name 
)

Get a vector from matlab into a goVector.

Parameters
vecgoVector that holds the data on successful return.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ getVector() [2/2]

bool goMatlab::getVector ( goMath::Vectorf vec,
const char *  name 
)

Get a vector from matlab into a goVector.

Parameters
vecgoVector that holds the data on successful return.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ matlabCall()

bool goMatlab::matlabCall ( const char *  command,
goString resultBuffer = 0 
)

Execute matlab command.

Parameters
commandCommand string, any valid matlab script will do.
resultBufferIf not 0, will be filled with the string output of the call, up to the length of resultBuffer. If 0 (default), no output buffer is used.
Returns
True if successful, false otherwise.

◆ put2DPoints() [1/2]

bool goMatlab::put2DPoints ( const goList< goMath::Vectord > &  l,
const char *  variableName 
)

Put 2d points from list to matlab matrix.

The x and y coordinates of the points are stored in a matlab matrix of size 2xN, where N is the number of points. The first row contains the x coordinates, the second row contains the y coordinates of the points.

See also
goMatlab::get2DPoints()
Parameters
lList of points (only x and y coordinates are used).
variableNameName of matlab matrix.
Returns
True if successful, false otherwise.

◆ put2DPoints() [2/2]

bool goMatlab::put2DPoints ( const goList< goMath::Vectorf > &  l,
const char *  variableName 
)

Put 2d points from list to matlab matrix.

The x and y coordinates of the points are stored in a matlab matrix of size 2xN, where N is the number of points. The first row contains the x coordinates, the second row contains the y coordinates of the points.

See also
goMatlab::get2DPoints()
Parameters
lList of points (only x and y coordinates are used).
variableNameName of matlab matrix.
Returns
True if successful, false otherwise.

◆ putArray() [1/2]

bool goMatlab::putArray ( const goArray< goDouble > *  array,
const char *  name 
)

Put a resizable array to matlab.

Parameters
arrayArray to put.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ putArray() [2/2]

bool goMatlab::putArray ( const goDouble *  p,
goSize_t  length,
const char *  name 
)

Put a C array to matlab.

Parameters
pPointer to first element.
lengthLength of the array (number of elements).
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ putDouble()

bool goMatlab::putDouble ( goDouble  d,
const char *  name 
)

Put a double value to matlab.

Parameters
dValue to put.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ putRGBImage()

bool goMatlab::putRGBImage ( const goSignal3DBase< void > *  sig,
const char *  name 
)

Puts a multichannel signal as RGB image to matlab.

The image created in matlab is of type mxUINT8_CLASS and has 3 channels (R,G,B). The data type of sig does not matter, the data is simply cast to goUInt8. No quantisation is done.

Parameters
siggoSignal3DBase to put into matlab (multi-channel)
nameName of the matlab variable.
Returns
True if successful, false otherwise.

◆ putSignal()

bool goMatlab::putSignal ( const goSignal3DBase< void > *  sig,
const char *  name 
)

Put a single channel of sig as matrix to matlab.

Parameters
sigSignal to put to matlab.
nameVariable name in matlab.
Returns
True if successful, false otherwise.

◆ putSparse()

bool goMatlab::putSparse ( goSparseMatrix sm,
const char *  name 
)

Put a sparse matrix stored in a goSparseMatrix.

goSparseMatrix objects can be used to assemble a sparse matrix quicker than in matlab itself. Its computational possibilities are limited.

Parameters
smSparse matrix to put.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ putString()

bool goMatlab::putString ( const goString str,
const char *  name 
)

Put a string to the matlab engine.

Parameters
strString to put.
nameName of the matlab variable.
Returns
True if successful, false otherwise.

◆ putVector() [1/2]

bool goMatlab::putVector ( const goMath::Vectord vec,
const char *  name 
)

Put a goVector to matlab.

Parameters
vecVector to put.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ putVector() [2/2]

bool goMatlab::putVector ( const goMath::Vectorf vec,
const char *  name 
)

Put a goVector to matlab.

Parameters
vecVector to put.
nameMatlab variable name.
Returns
True if successful, false otherwise.

◆ startEngine()

bool goMatlab::startEngine ( )

Starts a new matlab engine.

Returns
True if successful, false otherwise.

◆ stopEngine()

bool goMatlab::stopEngine ( )

Stops the matlab engine.

Returns
True.