| MATLAB Application Program Interface | Search  Help Desk |
| engGetMatrix | Examples |
Read mxArrays from a MATLAB engine's workspace
integer*4 function engGetMatrix(ep, name) integer*4 ep character*(*) name
ep
mxArray to get from engine.
This routine allows you to copy an mxArray out of a MATLAB engine's workspace.
engGetMatrix reads the named mxArray from the engine pointed to by ep and returns a pointer to a newly allocated mxArray structure, or 0 if the attempt fails.
Be careful in your code to free the mxArray created by this routine when you are finished with it.
On UNIX systems, engGetMatrix issues the command save stdio name to MATLAB, causing MATLAB to write the named mxArray down its stdout pipe, which is in turn caught and decoded by engGetMatrix.
See fengdemo.f in the eng_mat subdirectory of the examples directory for a sample program that illustrates how to call the MATLAB engine functions from a Fortran program.